Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read data from the instrument using ni-visa in cpp

using the viRead() i am not able to fetch the output from my rigol oscilloscope .

First i am giving the data using viWrite() to the oscilloscope to print sine wave with some frequency and voltage .This works properly .

After this i am calling viRead  with SCPI command "WAVeform:data" to fetch data from the oscilloscope but getting some errors. 

Can please someone help me in this .(by providing the steps to how to fetch data from instrument or which api's of ni-visa to use for fetching the data).

0 Kudos
Message 1 of 4
(115 Views)

What interface do you use? GPIB, RS-232, USB-VirtualComm, USB-TMC, TCP/IP?

If it is not GPIB or USB-TMC you almost certainly need to add a carriage-return and/or line feed to every single command in order for the instrument to know that it can now parse and interpret the command. Without that, most instruments will sit there until hell freezes over, waiting for the final indication that the command is complete.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 4
(92 Views)

I am using USB TMC interface.

0 Kudos
Message 3 of 4
(65 Views)

"WAVEform:data" may or may not be a valid command for your device. But without a question mark at the end, the device will never respond at all if it is SCPI compliant. All query commands require a question mark at the end to tell a device that it needs to send something back. If that still doesn't work try to append \r, \n or \r\n to the string.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 4
(61 Views)