XBee API Messaging

Greetings,

I am trying to toggle remote XBee I/O pin DIO4 with PIC firmware and API frame data. The test setup worked fine with Digi development boards, but with my breadboard circuits the API data is transmitted but nothing happens at the receiver. The coordinator code is below, does anyone see anything I am missing? Has anyone tried this before? It seems like a great way to avoid using a lot of command messages.

Thanks!

/* PIC to PIC transmit.c

Send API frame data to client from coordinator to toggle DIO4 */

#include <18f2520.h>

#fuses INTRC, NOLVP, NOWDT

#use delay(clock=8000000)

#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, bits=8, parity=N)

#include <stdlib.h>

// API frame data

#define DIO4_ON_51 “7E00101705000000000000000000510244340414”

#define DIO4_OFF_51 “7E00101705000000000000000000510244340513”

void main()

{

// int i;

setup_oscillator( OSC_8MHZ );

output_high(PIN_C4); // C4 = Pin 15

delay_ms(500);

output_low(PIN_C4);

while (TRUE)

{

printf(DIO4_ON_51);

delay_ms(950);

printf(DIO4_OFF_51);

delay_ms(950);

}

}

#define DIO4_ON_51 “7E00101705000000000000000000510244340414”

This looks like a text string. The API frame must be in hex like this:

0x7E, 0x00, 0x10, etc

Look up in your compiler manual on the syntax to do this in hex.

This is assuming that the API frame and checksum is correct. If anything in the API frame is wrong the entire frame is quietly ignored, no error message.

Thanks for the tip. I tried to put the API frame fields in a structure in hex and printf the data in various ways without success. I may just use the digital I/O pins for now and play with this method later.