How to connect to an instrument using RS-232 to USB converter?
조회 수: 1 (최근 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!