Code:'############################################### '# '# program to test Tx & Rx API packets on '# xb24 series 1 units. '# '# host mcu's= pic16f88 '# '############################################### '---[set fuses]--------------------------------- 'Program Configuration Register 1 @ __CONFIG _CONFIG1, _HS_OSC & _DEBUG_OFF & _WDT_ON & _LVP_OFF & _CP_ALL & _CPD_ON & _BODEN_ON & _MCLR_ON & _PWRTE_ON & _WRT_PROTECT_OFF ;Program Configuration Register 2 @ __CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF '---[includes----]------------------------------- INCLUDE "bs2defs.bas" '---[debug defines]------------------------------- DEFINE DEBUG_REG PORTA DEFINE DEBUG_BIT 2 DEFINE DEBUG_BAUD 9600 DEFINE DEBUG_MODE 1 '---[defines]-------------------------------------- DEFINE OSC 8 'DEFINE HSER_RCSTA 90h DEFINE HSER_RCSTA 92h ' Enable serial ports Tx & Rx, sets SPEN & CREN & OERR DEFINE HSER_TXSTA 24h ' Enable Tx HS, TXEN=1 & BRGH=1 DEFINE HSER_BAUD 9600 ' set baud and compiler will auto calc HSER_SPBRG DEFINE HSER_CLROERR 1 ' Clear overflow automatically ANSEL=0 ADCON0=0 ADCON1=7 CMCON=7 '---[contants]--------------------------------------- LF CON 10 CR CON 13 MAX_DATA_LEN CON 12 '----------------------------------------------------------------------- BLINK_PA1 VAR portA.1 BLINK_PB1 VAR portB.1 'to show sending serial data TX_APIPacket VAR byte[14] Counter VAR byte Checksum VAR byte Ndx VAR byte '----------------------------------------------------------------------- INIT: Clear gosub FILL_API_PACKET MAIN: FOR counter=0 to 35 gosub sub_Test_Tx_API_Frame next counter goto MAIN sub_Test_Tx_API_Frame: gosub sub_CALC_Checksum 'send debug to realterm window Debug "TX= ",str TX_APIPacket\13," ", hex checksum, " [Cnt: ",dec counter,CR hserout [str TX_APIPacket\13, checksum] gosub sub_BLINK_PB1 'show pic is alive pause 500 RETURN FILL_API_PACKET: TX_APIPacket(0)=$7E TX_APIPacket(1)=$00 TX_APIPacket(2)=$0A TX_APIPacket(3)=$01 TX_APIPacket(4)=$01 'API frame ID TX_APIPacket(5)=$50 'DL addr TX_APIPacket(6)=$01 'DL addr TX_APIPacket(7)=$00 'option TX_APIPacket(8)=$48 'H TX_APIPacket(9)=$65 'E TX_APIPacket(10)=$6c 'L TX_APIPacket(11)=$6c 'L TX_APIPacket(12)=$6f 'O RETURN sub_CALC_Checksum: Checksum = 0 for Ndx = 3 to MAX_DATA_LEN Checksum = Checksum + TX_APIPacket(Ndx) next Checksum = $FF & Checksum 'remove values > 1 byte Checksum = $FF - Checksum '2's compliment RETURN sub_BLINK_PA1: High BLINK_PA1 pause 200 low BLINK_PA1 PAUSE 200 RETURN sub_BLINK_PB1: High BLINK_PB1 pause 200 low BLINK_PB1 PAUSE 200 RETURN END
mcu=pic16f88
xbee=xb24
i'm sending a string then checksum from the host pic16f88 to a xbee and that xbee sends it to another xbee. somewhere around 34-35 iterations for a total of 504 bytes the xbee's stop sending/recieving.
the pic is still sending the string out as i can see this with a LCD
connected to the Tx pin on the sending host.
Now, i can use two xbib dev boards connected to my computer with one of the xbee's on each and send the same API packet with no issues.
so i'm leaning towards the problem is my pic16f88 or my program/fuses or both.
any thoughts on why this is happening?
thx
archendekta




Bookmarks