API mode doesn't work correctly (Xbee-Pro)

Hi, I’m using a PIC (16F628A) with UART module which communicates with the Xbee-pro (802.15.4-Version 10CD) module (mode API enabled).

SETTINGS MODULE XBEE-PRO

Radio 1 (NI=BASE) Radio 2 (NI=REMOTE)

AP = 1 AP = 0

DL = 5001 DL = 5000

MY = 5000 MY = 5001

  • other settings default

ASSEMBLE PACKET

7E 00 0A 01 01 50 01 00 48 65 6C 6C 6F B8

CODE ASSEMBLER (routine transmission)

SEND

MOVLW 0x7E

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0x0

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0x0A

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0x01

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0x01

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0x50

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0x01

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0x0

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0x48

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0x65

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0x6C

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0x6C

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0x6F

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

MOVLW 0xB8

MOVWF TXREG

MOVLW .2

CALL DELAY_MS ; ROTINA PARA 2MS

RETURN

PACKET RECEIVED BY ANOTHER MODULE XBEE-PRO (NI=BASE)

Connected to serial and read with the program X-CTU terminal.

7E 00 13 81 50 01 33 00 7E FE 3F FE FE EF FE FE DB F6 B6 B6 6F EE BE

I think this is the correct package:

7E 00 0A 81 50 01 24 00 48 65 6C 6C 6F 15

Data ASCii: “Hello”

I looked for it at forum but I have no idea about what is the problem. ¿Any idea?

What is wrong? Somebody help me?

Thanks very much!

I have a problem that is very similar with this. At the API MODE I receive a package (the frame) that does not contain the correct serial data that I use to see when I was using the AT mode.

Help please!!

Caro André,

consegui resolver o problema iniciando o xbee com o pino TX em nível alto (5V). Tente isso e me fale, ok?

Abraços!

Vitor

the original poster’s code is assembly rather than C. Why?

There is a delay between sending each byte whereas normally one sends the UART a byte when the transmit holding register empty status bit is true.

I’ve used the API mode for a long time. If you calculate the transmitting frame correctly, including the correct algorithm for the checksum (per the XBee OEM manual), it works reliably.

andregalvao:
I have a problem that is very similar with this. At the API MODE I receive a package (the frame) that does not contain the correct serial data that I use to see when I was using the AT mode.

Help please!!

I will need more information on what XBee you have, the firmware version and what the XBee parameter settings are. You you are receiving API frames on the receive end I can help you decode them. If the API frame is properly built and received then the data is in the ‘payload’ section of the API frame.