How to connect to an instrument using RS-232 to USB converter?
3 ビュー (過去 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 Connection and Communication についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!