Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

receive data from other pic

Status
Not open for further replies.
/*
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
 
It sounds like your baud rate is slightly off. Try rechecking your baud rate generation and make sure it's correct.

Brent
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top