Serial I/O not getting input
Show older comments
Hi,
I am attempting to communicate with an XBee radio through Matlab serial, and while I am able to send data successfully, I am having trouble getting anything from the input.
For example, I can send a message with the following code to a terminal program connected to a matched XBee radio:
s = serial('COM8');
fopen(s);
fwrite(s,'TestMsg');
However, if I send a message from the same terminal that received the Matlab message, I cannot detect the message in Matlab using fscanf(s), or setting up a bytesavailable event with:
s.BytesAvailableFcnMode = 'byte';
s.BytesAvailableFcnCount = 1;
s.BytesAvailableFcn = @instrcallback;
I know the message is going through the radios because if I connect to the same serial port with a another terminal program (PUTTY or X-CTU) it shows up, so it seems like the problem must be with Matlab.
Thanks for any help!
Accepted Answer
More Answers (1)
Adi Mico
on 28 Jul 2011
0 votes
Maybe you have to set the terminator.
1 Comment
Gabriel Ryan
on 28 Jul 2011
Categories
Find more on Communications Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!