Instrument Control (GPIB, Serial, VISA, IVI)

Showing results for 
Search instead for 
Did you mean: 

Timing issue in reading the buffers from NI VISA

I have a device Keithley K2602B Source meter which supports NI VISA based "GPIB" communication

Let us say that the I measured four current values and saved these measurements in Buffer1. Now device buffer1 has 4 readings in it

Say I have something like :

for ( i =1; i<=4; i++)


 str =  ReadString(Int32 count);  // Reads a string from the formatted read buffer. This is taken from VISA Implementation
Specification for .NET Documentation by NI VISA



When  i = 1, the data is received from the Device buffer1 in 200 milliseconds.

When i = 2,3,4 the data is received from device buffer1 in 1 milliseconds respectively


Why does it take a longer time to get the 1st data from the device while the other retrievals take less time ??

Please share this info

0 Kudos
Message 1 of 4

Are you sure the first measurement was completed before you're trying to read?


My guess, for the first reading, the measurement is still in progress and for consecutive measurements, by the time you attempt to read/fetch the measurement is already completed and hence no waiting for the data.

Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 4

The measurement was completed before I started reading the buffer. We could see the results in the buffer from the device front pannel.


Does Visa do something like this -
It fetches the all data from the device internal memory and puts it somewhere on PC external memory when I try to get the 1st data. If VISA puts it somewhere it can access easily then maybe that is why the next fetch takes less time
Or does VISA establish some kind of connection/link/pathway on its 1st access to the buffer and on successive calls since the connection is already established it does not take time 



0 Kudos
Message 3 of 4


Do you open your connection just before accessing the first data, or long before that.

Opening and closing of a visa session normally is executed at the beginning and end of a program, not just before and after an access of the port.

And opening sure takes some time.

greetings from the Netherlands
0 Kudos
Message 4 of 4