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

Bluetooth, XBee, RF......

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

Postby apple » Thu Jun 14, 2012 2:16 pm

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.
apple
Greenhorn
 
Posts: 2
Joined: Fri Apr 20, 2012 12:01 pm

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

Postby yonghui » Thu Jun 14, 2012 2:37 pm

is that printf print to uart? sending 'a' character to xbee?
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

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

Postby robosang » Tue Jun 19, 2012 8:32 am

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.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

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

Postby goodhuman » Wed Jun 20, 2012 12:06 pm

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
goodhuman
Freshie
 
Posts: 7
Joined: Fri Dec 16, 2011 3:17 pm


Return to Wireless Device

Who is online

Users browsing this forum: No registered users and 14 guests