Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read data from the serial port?

How to read data from a serial port RS-232C? I’m sending a command using VISA write, and use VISA read to get the data from the port, but what I’m getting back is the first command character (e.g. if I use the command “SEND”, what I’m getting back is “S”) with error 1073676294.
0 Kudos
Message 1 of 3
(3,561 Views)
Se:

What you got back was not an error. Status code 3FFF0006 just means you got back everything you asked for, so it is possible that the instrument has more data.

It sounds like you just asked for 1 byte, since that's all you got. If you are expecting more data, then ask for the total amount (or more). VISA will read from Serial up to the termination character (by default), so this works well with ASCII devices.

Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
0 Kudos
Message 2 of 3
(3,561 Views)
Mondrik,

If I ask for more byte e.g. 2 I'll get time out error: 107367292.
0 Kudos
Message 3 of 3
(3,561 Views)