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: 

Need Help: How to wait indefinitely for a response from an instrument

At the wavelength 880nm the monochromator changes grating. So the monochromator takes long time to respond to this wavelength. So I need to wait indefinitely (because I don't know how much time to wait) for the monochromator to respond that the wavelength has been set. I have done two things but it is not working:

 

1). I have increased the default timeout for visa read and write to 3600sec from 10sec. I assumed that in 1 hour the respond may come. But it didn't.

 

2). I put the Visa read node in a while loop. The while loop goes on whenever it encounters the timeout error -1073807339 with the default timeout being 10sec. Hence in each iterations of while loop the Visa read node attempts to read the response for 10sec. Thus Visa read attempts to read indefinitely (as I think) in packets of 10 seconds. But this also didn't work.

 

I need help in achieving this task of waiting indefinitely for a response.

Thanks in advance!!!

 

I am enclosing screenshot of both the efforts below in jpg format and the command code for monochromator.

0 Kudos
Message 1 of 5
(2,743 Views)

Try to go through all the steps in VISA test panel in NI MAX. Do you do exatly the same in your code? Do you send the commands and read back the acknowledgement for each?

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 5
(2,716 Views)

Don't know if this is the cause of the problem

 

Since you posted a picture of the VI, I can't tell what value you used for the "Acting Wavelength". I would recommend using "U16" (0 to 65535). You are using an "I16" (-32768 to 32767). I believe wavenumbers are positive numbers. I would recommend using "U16" (0 to 65535).

 

for example if Acting wavelength is 200
U16 0xC350  =   50000 dec
I16 0x7FFF  =   32767 dec

 

The correct value is 10e6/200 = 50000
The I16 truncates the results to the max positive integer.

 

0 Kudos
Message 3 of 5
(2,676 Views)

You may want to characterize your monochometer's movement times. You could come up with a worst-case time for the greatest possible change and use that for your timeout. Or you could measure various times across consecutive intervals so you could extrapolate/interpolate more accurate movement times between any given wavelengths.

0 Kudos
Message 4 of 5
(2,662 Views)

If you are sending the correct wavenumber, then the device should send back an "ack". I was just thinking that this might be one of those RARE examples for using "Bytes at Port". Try it, it may work.

 

It is an infinite loop. So put some conditional in there to abort the loop, and also some wait time so that the loop doesn't hog all the CPU time.

bytes at port pic.png

0 Kudos
Message 5 of 5
(2,658 Views)