Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing issues with GPIB Read on a SR400

Solved!
Go to solution

I am using LabView to control a SR400 Photon Counter from Stanford Research Systems. I can control the box easily, but am having problems with reading the correct data from the box. I am getting repeated incorrect values of '0, 6, and 134' instead of the actual count numbers. I see the correct values on the box display screen, but GPIB reads the wrong ones. 

 

This is what I have tried and what I have learned:

  • At first, I was getting random LabVIEW Error 6 (from GPIB read) which would stop my program from running. To fix this, I put an error case statement after it and simply write the word ERR to my data file and move onto my next data point. This stopped my program from aborting, but started mis-reading the values using GPIB Read.
  • The SR400 takes data for N periods on two channels, A & B. The first column of channel A would be all 6s and the rest of the columns on both channels would be the regular values. However, the probelm got worse and my first column of channel A started writing 0s, the second column of channel A would be 6s with a few 134s and the rest of the columns would be fine. But, if I only had 1 period for each column, I now lost data on both A and B channels. A channel would be 0s, and B channel would be 6s and 134s.
  • This problem is sporadic. I cannot control when it happens. Today it is working. Yesterday is did not.
  • It looks to be a timing issue, but I don't know what I can do to fix it.

 

My questions for all of you are:

  1. Is it better to use GPIB or VISA to communicate? I will use GPIB cabling either way.
  2. How do you fix timing issues in GPIB?
  3. Any suggestions on how to improve this?

I have attached code from 8.2 and 2011. I am in the process of converting our code to 2011 to see if it solves the issues. The VI with GPIB Read is CollectData/TakeData and it is called by a VI, PMT Cooldown where it gets called frequently, but all reading and writing is done by the CollectData/Take data files.

 

I thank you all in advance for your help. I am a grad student and am still learning about LabVIEW and these electronics.

0 Kudos
Message 1 of 6
(5,181 Views)
Solution
Accepted by topic author efcloos
Start with lowering the busspeed. I believe that 1 uS is more than fast enough for handshaking and next I would disable autopolling.
You can do this in Max settings for your gpib card.
Low level visa uses gpib but never use it directly. Anyhow the speed is completely determined by the slowest device on the bus,robably the sr400
greetings from the Netherlands
Message 2 of 6
(5,180 Views)

Thanks so much for the help! I switched my code to 2011 and slowed down my bus speed from 2 ns to 2 us. The problem is now solved.

0 Kudos
Message 3 of 6
(5,128 Views)

glad to know it works.

greetings from the Netherlands
0 Kudos
Message 4 of 6
(5,126 Views)

Probably an easy question for the more "computer-literate", but how do you change the bus speed?  I am having this same issue with my photon counter as well.

0 Kudos
Message 5 of 6
(4,975 Views)

Open MAX (Measurement & Automation Explorer) >>Devices and Interfaces>> Select your GPIB card.

Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 6 of 6
(4,967 Views)