Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB read multiple data from instrument buffer

Hello,

I am using Labview 7 to control a Stanford Research Photon Counter (SR400) and am having trouble with reading the data in the SR400 buffer fast enough.

First, the scheme that works (but is too slow):
The SR400 is sent a command to collect 1000 data points and dump the results to the buffer.  I then use the GPIB READ vi in a FOR loop to read the 1000 data points and put them in an array.  This works very well, but I find that is adds several hundred milliseconds of time to my program (which adds up to a great deal of time as I need to perform this operation ~ every 1 second for 1 day).

I figured that instead of sending 1000 GPIB READ commands, it would be faster to send 1 GPIB READ to read the entire buffer and then parse the data string later.  However, I cannot figure out how to use GPIB READ in this manner - I always seem to only read 1 data point at a time.  

As far as I understand each data point sent by the SR400 is separated by a <cr><lf>, so I thought that I should be able to change the GPIB READ "end mode" so that it reads a number of bytes and doesn't look for either <cr> or <lf>.  I tried setting the mode to 0 (or leaving it unconnected) and using all kinds of byte lengths (from 2-1000) and I still always read only a single data point.  (I also tried the GPIB RECEIVE vi and found the same results).  I also used MAX to change the "Termination Character Enable" to FALSE, but it didn't seem to help.

I wonder if it has anything to do with when an EOI is sent?  How can I figure that out?  And what exactly is an EOI???! 

Suggestions and examples would be very much appreciated, thank you,

KMD   ðŸ˜‰
0 Kudos
Message 1 of 4
(4,930 Views)
Hi KMD,
You could try using the VISA Read.vi
The VISA Resource Name will look something like GPIB0::2::INSTR


Regards,
John E.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 4
(4,903 Views)
Hi

EOI stands for End or Identify and is a control line on the gpib-bus.

You should indeed do a VISA read as John mentioned and make sure that the endcharacter is disabled.
than you should wait until so many bytes as you need are available and then read them.

In LabVIEW it is easy to do this IO parallel to the rest of your program. Check the examples on parallel programming in LabVIEW.
This means that the IO does not hinder the identification of the previous read characters.
greetings from the Netherlands
0 Kudos
Message 3 of 4
(4,884 Views)
Hello,

Just wanted to thank you both for the useful replies.  Now I am using a parallel approach as you suggested to read the data as it appears in the buffer, which saves me a great deal of time.  I still read the data point-by-point, but the delays occur while my program is doing other things, so in the end the total program runs much faster. 

I never figured out how to read the entire scan and now suspect that an EOI is sent after each data point (contrary to the information I received from Stanford Research).  If this is the case, I don't know if it is even possible to read the entire scan in one read operation...

In any case, this part of the problem is solved, many thanks again!

-KMD 
0 Kudos
Message 4 of 4
(4,823 Views)