From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA GPIB listen / device talk

hello one and all,

i want to be sure that i implement this correctly, so please verify my understanding and questions.  i am using VISA protocol but the device is a GPIB device connected to a NI GPIB 488.2 PCI card.  i want to put my device in a GPIB talk mode so that it can transfer data to labview as fast as possible.  apparently, i can set a sampling rate on the device to send data through the GPIB bus at that rate. 

from what i can understand from the manual and an arcane c example program, i can set a device timeout that slightly exceeds the total number of data points to be transfer divided by the sampling rate, or that time for a full scan and transfer of the data.  i can also set the timeout to zero and the point is that the GPIB communications don't timeout and interuppt the data transfer.

i also believe that i need to put the device in talk mode and the computer/labview/VISA in listen mode for the time of the scan or fast data transfer.  i am a bit confused on which VISA components to use for put the device in talk mode and the computer/labview/VISA in listen mode, which ones are they and what parameters/settings are best for this purpose.  once the computer is in listen mode, i can quickly and iteratively grab the data as it comes through the GPIB bus.  i then need to put the device and computer back in their original talk/listen modes after the fast transfer is complete.

i also believe that this is synchronous communication, is that correct?

thank you in advance and have a great day.

lucas
0 Kudos
Message 1 of 4
(3,199 Views)
I think you are making things more complicated than they need to be. Normally, you put an instrument in talk mode whenever you send a command that requests data. You do this with a VISA Write. As soon as you do this, you just use a VISA Read to get the data. If an instrument is compliant with 488.2, it will append EOI at the end of the data string. The VISA Read will automatically terminate when it sees this. So, even if you are expecting say, 100 bytes, you can specify a much larger number and it wouldn't make a difference. you won't get a VISA timeout so you don't need to play around with this.

What exactly is the make and model of instrument? Have you looked to see if there is a driver already written for it? You can go to http://www.ni.com/devzone/idnet/default.htm and searc for one.
0 Kudos
Message 2 of 4
(3,187 Views)
ok, yes, that makes sense and i have just been playing with that direct sort of method.  visa write and then read.  in fact, write the command once to put the device in that mode and then read within a while loop, reading 4 bytes at a time.  4 bytes is the length of one "record" sent by the device.

the model is the stanford research SR830 lock-in amplifier and i am attempting to code for its FAST2 mode.  in this mode it transmits a 4 byte integer and i don't believe it has any EOI at the end of it.  can i test for the presence of this EOI character?  this makes it a bit funcky.  how can you query the visa read/receive buffer to see how many bytes are left in the buffer?  any other suggestions?

lucas
0 Kudos
Message 3 of 4
(3,181 Views)

If there is any data remaining, it is in the instrument's transmit buffer.

I don't think I was very clear about EOI. This is a dedicated line on the GPIB bus but if I remember correctly, you can see this being asserted if you run NI-Spy.

I'm not familiar with the SR830. If you could post a programming manual or a link to one, someone could help you with your program. Hopefully, someone with experience with the FAST2 mode will have an example.

0 Kudos
Message 4 of 4
(3,169 Views)