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.