Page 1 of 1

PIC18F4620 unable to transmit data to XBEE2(no output at tx)

PostPosted: Thu Jun 14, 2012 2:16 pm
by apple
Hello Guys,

I am connecting two XBEE together,
XBEE1 and XBEE2, XBEE1 as coordinator and XBEE2 as router.
I tried to connect them using XCTU and they are able to communicate with each other.

Then, i remain the XBEE1(coordinator) connected via XCTU, and i connect XBEE2 to my PIC18F4620, connecting XBEE2's RX to PIC's TX and XBEE2's TX to PIC's RX.

Then i run the program as below:

CODE: SELECT_ALL_CODE
 #include <18F4620.h>                   // PIC18F4620 HEADER FILE
 #include <stdlib.h>
 #fuses HS,NOWDT,NOLVP,NOPROTECT        // HIGH SPEED, NO WATCH DOG TIMER, NO LOW VOLTAGE PROGRAMMING
 #use delay (clock=20M)    // 20 MHZ CRYSTAL
 #use rs232(baud=9600, UART1)

 #define but1           PIN_A0   
 #define on             PIN_B4

 set_tris_a(0xFF);                // SET ALL PORT A AS INPUT PORT
 output_a(0xFF);                  // RESET PORT A
 set_tris_b(0x00);                // SET ALL PORT B AS OUTPUT PORT
 output_b(0x00);                  // RESET PORT B

 while(TRUE)                         // always repeat program below
 {
 if (!input(but1))                // when button 1 pressed 
  { while(!input(but1))                  //take action after sw1 is released
    {}
  delay_ms(100);//short delay to debounce the switch
  printf("a");
  output_high(on);
  }
 
 }}


but there is no signal received at the XCTU coordinator terminal.
I used multimeter to tab the voltage at TX of the PIC but there is no any change of voltage level, and i believe thats the problem in initializing or the coding.

Anyone with idea where is the problem?
And i would like to ask, can XBEE [rs232(baud=9600, UART1)] functions in PIC via HS(high speed)?

Thank you guys.

Re: PIC18F4620 unable to transmit data to XBEE2(no output at

PostPosted: Thu Jun 14, 2012 2:37 pm
by yonghui
is that printf print to uart? sending 'a' character to xbee?

Re: PIC18F4620 unable to transmit data to XBEE2(no output at

PostPosted: Tue Jun 19, 2012 8:32 am
by robosang
When you deal with communication, try to verify each module of your system, part by part, module by module. Now you verify the XBee is working by connecting to computer. You should do the same to your PIC. Connect it to computer using hard wire, using UC00A or UC00B from Cytron should be helpful. Troubleshoot it from there.

Re: PIC18F4620 unable to transmit data to XBEE2(no output at

PostPosted: Wed Jun 20, 2012 12:06 pm
by goodhuman
i think u should try using serial communication first UART or anything... try connect ur computer and ur controller using UART serial to verify the code u write is about to transmit data before plug in and use XBEE