Clear Filters
Clear Filters

How to connect to an instrument using RS-232 to USB converter?

1 view (last 30 days)
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?

Answers (0)

Categories

Find more on Instrument Connection and Communication in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!