Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Handle delays after command request in NI-VISA API

Solved!
Go to solution

 

I use NationalInstruments.VisaNS.dll to communicate with Tektronix oscilloscope. There are many types of measurement.

For example, below code is for frequency measurement.

 

string response;
tekResource.Write("MEASUREMENT:MEAS1:TYPE FREQUENCY");
tekResource.Write("MEASUREMENT:MEAS1:SOURCE1 CH1");
tekResource.Write("MEASUREMENT:MEAS1:VALUE?");
response = tekResource.ReadString();

The issue is that when I request the value immediately after setting the measurement type, it returns 9.9E+37 (infinity). If I wait about two seconds, than it returns correct value.

Is there graceful way to get frequency value without polling the device in a while loop? Polling the device looks not robust approach because sometimes it returns me the previously measured value.

0 Kudos
Message 1 of 2
(1,177 Views)
Solution
Accepted by topic author RaspberryIceCream

Seems I was using wrong measurement method.

Programmer manual says:

"The best method for taking measurements over the computer interface is to use the MEASUREMENT:IMMED commands and queries. The immediate measurement has no front-panel equivalent, and the oscilloscope never displays immediate measurements."

string response;
tekResource.Write("MEASUREMENT:IMMED:TYPE FREQUENCY");
tekResource.Write("MEASUREMENT:IMMED:SOURCE1 CH1");
tekResource.Write("MEASUREMENT:IMMED:VALUE?");
response = tekResource.ReadString();

 

Message 2 of 2
(1,154 Views)