How to read data from Xbee programmable in C code?

I have tried the functions xbee_ser_getchar and xbee_ser_read from “xbee/serial.h” but none seems to work. I can send chars using my programmable xbee, but when I try to read a char I only get 0. This xbee is a router in a Router-Coordinator network and, besides that, one talk to each other normally when I open both terminals.

What are the full part numbers of both XBee modules in question?

It’s XB24CZTWITB003: XBee S2C ZigBee Programmable, Through-Hole, Wire Antenna.



Have you looked at any of the transmit basic frames or the Clusters and Endpoints communications examples offered in the XBee SDK for Code warrior? I think you will find that they don’t use the xbee_ser_getchar (get character) command.

As a matter of fact, yes. I tried most of them but they don’t seem to work properly (either compiling errors come up or, when loaded, its mirrors the chars I send through the console. I’m now working on editing some pieces of code to see if I can make it work. Ideally, what I want is Terminal 1 - Xbee 1, Xbee 2 alone and Terminal 3 - Xbee 3, so I could send info from terminal 1 through Xbee1 to Xbee2 (the code should read from 1 and send to 3) and finally through xbee 3 to terminal 3.

Back to the other functions, xbee_ser_putchar works well, while xbee_ser_getchar does not.

Then what you want is the transparent app that is already one of the examples or not to use the programmable but the standard modules instead.

mvut, I agree. But I want to do this so that I can insert some other coding (for example, xbee 2 provides an incremental of the char - receives ‘a’, sends ‘b’; receives ‘m’, sends ‘n’).

At this very moment, I made the “transmit_basic_frames” example work, but with the S2C option on CodeWarrior. Which is wierd is that even though my device has the S2C label, CodeWarrior shows S2B as TH and S2C as SMT. So I chose S2B and didn’t work the example, but now it works when I choose S2C. Any thoughts on that?

Yes they are different RF processor with different pins and configurations.

That’s true. But the names they use don’t quite match… I mean, S2C does not imply being SMT, as Code Warrior says… anyway, I changed my options into S2C and it works now with the examples, so I am going from there. Thanks a lot!!