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
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.
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
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.