Receive API packets from Xbee to PIC18f4620

Hi everyone,

I’m having trouble in receiving an API packet from XCTU program to the PIC18F4620.

The setup is as follows:

There is one device with an Xbee module connected to a PIC18F4620 with an LCD display.

At the other end, the Xbee is connected to the computer via a serial port.

I am able to send the packet from the Xbee and PIC18f4620 to the XCTU, and It displays the values. This is the apcket I was able to sent.


But when I tried to send the same packaet thorugh XCTU to Xbee and the PIC then it doens’t display the values correctly.

I’m not 100% sure of my coding, specially the part where we try to display the values in the USART in the LCD display.

Could somebody please help me, or at least guide me in the right way.

Thanks in advance.

Below is a part of the code that we wrote using MikroC. This get get the values from the USART and displays it on the LCD. I can get the first value of 7E to be displayed on the LCD, but I’m not sure how to code this to get the packet as a whole.

if (Usart_Data_Ready())
test=Usart_Read(); //test data type is unsigned int

      IntToStr(test, array);// array is of data type char


Doesn’t anybody have an answer for this?

What does “doens’t display the values correctly” mean

First of all…thanks for your reply, I haven’t checked the digi forum in a while, therefore I just saw your post.

What I meant by ‘doesn’t display the values correctly’ was that the value is not displayed correctly on LCD SCREEN. I’m sorry for not noting that. The only value that is being displayed on the LCD screen is the 126 value. Which i think is the 0x7E value in decimal format.

I’m sure that the packet that i’m sending from the XCTU is going to the Xbee module connected to the PIC because of the above evidence, but I dont think I have correctly written the code to collect the data from the UART of the PIC.

If you have some sort of coding or advice on how to collect a data packet from the UART or how to manipulate this situation in a convenient way, please let me know.

Im really stuck on this, and the deadline for the project is in a week’s time…

any help would be really appreciated.