Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 21st March 2004, 01:37 PM   #1
Default receive data from other pic

/*
sensor.c
*/
#include <16F877A.h>
#device adc=8
#use delay(clock=20000000)
#fuses NOWDT,HS, PUT, BROWNOUT, NOLVP


// #use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)
// i exchange pin_c6 & c7 because 2 ports are connected directly

#use rs232(baud=9600,xmit=PIN_C7,rcv=PIN_C6)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3)

void main() {

while (1) {
printf("Hello World!");
}

}

/*
receiver.c
*/

#include <16F877A.h>
#device adc=8
#use delay(clock=20000000)
#fuses NOWDT,HS, PUT, BROWNOUT, NOLVP
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3)

#USE RS232(BAUD=9600, XMIT=PIN_C6, RCV=PIN_C7, STREAM=RS_DEBUG)
#USE RS232(BAUD=9600, XMIT=PIN_B6, RCV=PIN_B7, STREAM=RS_DATA)

void main() {

while (1) {

fprintf(RS_DEBUG, "--%C", fgetc(RS_DATA));
}

}

I got 2 rs232 port on receiver. one is for debugging, one is for receiving data from sensor.
However, it only generates rubbish on the screen, but not "Hello World"

How to display data from other PIC via rs232?

cheers
janetsmith2000@yahoo.com is offline  
Old 24th March 2004, 07:28 PM   #2
Default

It sounds like your baud rate is slightly off. Try rechecking your baud rate generation and make sure it's correct.

Brent
bmcculla is offline  
Reply

Thread Tools
Display Modes




All times are GMT. The time now is 06:25 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker