How to connect to an instrument using RS-232 to USB converter?
7 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm trying to remotely control an instrument through a serial port. To make the connection an RS-232 to USB converter is used. I have installed all the latest drivers of the converter. The following commands are used to create the serial object and connect to it.
s = instrfind('Type', 'serial', 'Port', 'COM3', 'Tag', '');
s = serialport('COM3',9600);
fopen(s);
The property values, baud rate etc., are matched with the instrument's one. The serial communication is opened with success but unfortunately, neither can I send data to the instrument nor receive. A timeout error is shown when trying to receive data. The pin status of the RS-232 is:
s.PinStatus
ans =
struct with fields:
ClearToSend: off
DataSetReady: off
CarrierDetect: off
RingIndicator: off
Also, when trying to query the IDN:
fprintf(s,"*IDN?\n")
s.NumBytesAvailable
ans =
0
I've tested the converter in other applications and worked as intented.
What would the solution be? Does it have to do with the converter itself?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Instrument Control Toolbox Supported Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!