05-11-2021 10:24 PM
I'm trying to control two instruments (laser and power meter) using NI GPIB. My code consists of a loop that sweeps the wavelength in both instruments and reads the power from the power meter.
The problem is that I need a time sleep step of at least 2.3 seconds inside the loop as shown below. If the sleep time is smaller, gpib reads wrong values from the power meter.
Without the time sleep step, I get the following error: VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
Any recommendations? Not sure if it's an instrument or communication limit
CODE
for wavelength in range(wavelen_1, wavelen_2):
lsr.write('sour2:wav %s' %str(wavelength*1e-9))
pwm.write("W"+str(wavelength))
time.sleep(0.4) #at least 2.3
power = pwm.query('D?', delay=0.09)
05-12-2021 12:50 PM
What Power meter (Brand & Model) are you using?
What does the PM manual say about required time to measure, process GPIB query and reply? What is the current timeout of the PM set to?
A power meter that is using old commands like 'D?' isn't going to provide a fast GPIB transfer speed!
Craig
05-12-2021 02:32 PM
I'm using Newport 1830 C
I'm not sure about the required time to measure, process query, and reply but the GPIB bus transfer time is 10 ms.
The time out is set to 3000 ms.