[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: serial communication
From: |
iceyj21 |
Subject: |
Re: serial communication |
Date: |
Thu, 22 Jun 2017 00:17:39 -0700 (PDT) |
Heres my code. Using cutecom to monitor the serial output of the rfid reader
that I'm sending the hex values to I found that its receiving the
"auto_read" command and then sending hex values out. What I'm facing now is
the inability to read those hex values with srl_read. the port is correct
and there is data that should be received but I'm not sure why octave isn't.
When looking at the variable values "tag" isn't being assigned anything form
the srl_write function.
clc;
clear;
s3 = serial("/dev/cu.SLAB_USBtoUART",115200,2);
set(s3, "dataterminalready", "off");
set(s3, "requesttosend", "off");
tag = [];
pkt = [0xBB, 0x00, 0x08, 0x00, 0x00, 0x7E, 0x0B, 0x96];
auto_read =
[0xBB,0x00,0x38,0x00,0x05,0x02,0x00,0x00,0x00,0x00,0x7E,0x51,0x7A];
i=1;
j=1;
while (i<9)
srl_write(s3,uint8(pkt(i)));
i = i+1;
srl_flush(s3);
endwhile
pause(1);
while (j<14)
srl_write(s3,uint8(auto_read(j)));
j = j+1;
srl_flush(s3);
endwhile
disp(pkt);
disp(auto_read);
pause(2);
[tag,n] = srl_read(s3,1000000);
tag_hex = dec2hex(tag,1000000);
--
View this message in context:
http://octave.1599824.n4.nabble.com/serial-communication-tp4683827p4683853.html
Sent from the Octave - General mailing list archive at Nabble.com.