thurmc
Newbie level 2
xbee pic
I am trying to set up a pic to send and receive commands using the Xbee RF transceiver. I am able to output commands from one PIC and I observe them on the receive pin of the Xbee on the other PIC. My problem is that the communication is not being registered by the remote PIC. We checked the receive pin of the RS-232 on the PIC and it looks like the signal is being input correctly and is 5V. Can anyone tell me what might be wrong? My code is below.
#if defined(__PCM__)
#include <16F877.h>
#device *=16,ADC=8
#fuses HS, NOWDT, NOLVP, NOBROWNOUT, NOPROTECT, PUT
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#endif
char reply;
void main() {
reply = '0';
output_bit(PIN_E1, 0);
while(1) {
output_b((byte)reply);
reply = fgetc();
if(reply != '0') {
output_bit(PIN_E1, 1);
}
}
}
We also tried using an if(kbhit()) so that the PIC does not hang while waiting for a character but this is not working either (no kbhit() is being registered). Thanks for your help.
I am trying to set up a pic to send and receive commands using the Xbee RF transceiver. I am able to output commands from one PIC and I observe them on the receive pin of the Xbee on the other PIC. My problem is that the communication is not being registered by the remote PIC. We checked the receive pin of the RS-232 on the PIC and it looks like the signal is being input correctly and is 5V. Can anyone tell me what might be wrong? My code is below.
#if defined(__PCM__)
#include <16F877.h>
#device *=16,ADC=8
#fuses HS, NOWDT, NOLVP, NOBROWNOUT, NOPROTECT, PUT
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#endif
char reply;
void main() {
reply = '0';
output_bit(PIN_E1, 0);
while(1) {
output_b((byte)reply);
reply = fgetc();
if(reply != '0') {
output_bit(PIN_E1, 1);
}
}
}
We also tried using an if(kbhit()) so that the PIC does not hang while waiting for a character but this is not working either (no kbhit() is being registered). Thanks for your help.