I have a transmitting xBee and a receiving one (both S6B series). I want to send an API frame to my xBee transmitter using MATLAB serial port. The frame is a simple Tx64 request sent to the receiving module. Both xBee settings and frame should be ok because I can successfully send the request using XCTU. The basic code I’m using is:
I believe the problem is the format I use for the frame, because I don’t have any errors from Matlab and RSS led on the receiving Xbee doesn’t turn on. It looks like the transmitting Xbee does not recognize the message as an API frame. I tried to convert it as decimal but still nothing.
After several trials I found the correct form for the outgoing message. As supposed, the error was in the format of the string which as to be converted to decimal. If anyone else is interested here is my solution:
Hy!It’s bit late for a question but i’ll try anyway…
I am facing the same problem. i am reading an API frame in Matlab but does’t seem to work. I have tried your solution and same result. could you pls provide more matlab code so i can try understand how you solved it?
Thank you very much!
Just a quick doubt about the APIframe message.
Does the characters of the message must be sent with separate by spaces, as you did?
‘7E length 00 frameID IPaddress 00 message checksum’
Or the can be sent together?
‘7Elength00frameIDIPaddress00messagechecksum’
Sorry for the late replay, I temporarily lost access to my code. The way I’m constructing the frame with Matlab is by filling a vector element by element with desired hex values expressed as char, for example:
frame(1, = ‘7E’; % Frame Class Name for reading only
frame(2, = ‘00’; % length 1
frame(3, = num2str(frmLgt); % length 2
frame(4:5, = [‘00’;‘00’]; % type & ID
frame(6:12, = [‘00’;‘00’;‘00’;‘00’;‘C0’;‘A8’;‘01’];
frame(13, = address;
frame(14, = ‘00’;
…
frame = hex2dec(frame);
fwrite(ssCOM, frame, ‘uint8’)
Hope this help, let me know if you need more info.