help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: API Frames in Serial_Write


From: John Donoghue
Subject: Re: API Frames in Serial_Write
Date: Sun, 8 Mar 2020 14:42:54 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1


Message: 2
Date: Sat, 7 Mar 2020 10:19:26 -0600
From: Grant Wise <address@hidden>
To: address@hidden
Subject: API Frames in Serial_Write
Message-ID:
        <address@hidden>
Content-Type: text/plain; charset="utf-8"

Hello,

I am attempting to write commands to an Xbee module through serial in
Octave. Problem is, to communicate this xbee needs to receive an API packet
(a vector of Hex values). Matlab appears to have a solution for this, see:
https://www.digi.com/support/forum/43073/send-api-frame-through-matlab-serial

However, it appears that srl_write will not accept vectors. Any
suggestions? Below is my code:


pkg load instrument-control

if (exist("serial") != 3)
   disp("No serial support")
endif

s1 = serial("COM4")
set(s1, 'baudrate', 115200);
set(s1, 'bytesize', 8);
set(s1, 'parity', 'n');
set(s1, 'stopbits', 1);
set(s1, 'timeout', 123);

frame(1,:) = '7E';                                      % Frame Class Name
for reading only
frame(2,:) = '00';                                     % length 1
frame(3,:) = '10';                % length 2
frame(4:5,:) = ['10';'01'];                        % type & ID
frame(6:13,:) = ['00';'13';'A2';'00';'41';'95';'83';'04'];    %64bit address
frame(14:15,:) = ['FF';'FE'];       %16bit address
frame(16,:) = '00';
frame(17,:) = '00';
frame(18:19,:) = ['48';'69'];  %data
frame(20,:) = '2E';   %sum

frame = hex2dec(frame)

fopen(s1)
ts = srl_write(s1, frame)   %error ->  Invalid call to srl_write.

%fwrite(s1, frame, 'uint8')       <- this didnt work either



Thanks for the help.
--
Grant Wise
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<https://lists.gnu.org/archive/html/help-octave/attachments/20200307/00070180/attachment.html>

------------------------------

Try:

srl_write(s1, uint8(frame))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]