02-22-2010 01:58 PM - edited 02-22-2010 02:00 PM
I must communicate with my instrument, but I must change its value, for example temperature, every loop. See the Figure to understand:
I think that it is better if I open communication with my instrument out of while loop so I many operation: if I put Open VISA in While loop I open VISA session every loop, instead I think it is not intelligent. Can I open VISA SESSION out of the while loop or it is an error for EXCELLENT LABVIEW VI and I must open and close VISA SESSION every times I must talk (and set) with instrument? What is the better way?
02-22-2010 02:17 PM
02-22-2010 02:19 PM
02-22-2010 02:31 PM
02-22-2010 02:36 PM
for(imstuck) wrote:
.... Remember to use a shift register for your errors, ...
Be careful with using shift registers on errors. It is not always a good idea. One minor error in a while loop iteration like a timeout error could mean that your later iterations will never run properly again because the error gets propagated to later loop iterations preventing things like a VISA read from executing.
02-22-2010 02:40 PM
Ravens Fan wrote:
for(imstuck) wrote:
.... Remember to use a shift register for your errors, ...Be careful with using shift registers on errors. It is not always a good idea. One minor error in a while loop iteration like a timeout error could mean that your later iterations will never run properly again because the error gets propagated to later loop iterations preventing things like a VISA read from executing.
I completely agree. In fact, I ran into this the other day. I was using a queue to pass errors to a loop that only handled errors. However, because i was using a shift register for errors, an error was being passed to the enqueue vi. Therefore, nothing was queued up! Good comment.
02-22-2010 04:21 PM
02-22-2010 04:42 PM - edited 02-22-2010 04:46 PM
Something like this?
I do have to say, i don't know what is happening in the false case of yours, but if nothing happens with the 100 that is wired to the shift register, once you enter the true case, the value in the shift register will always be great than "i". You might as well do what I have done then. However, if something does happen with that number in your false case, then keep it the way you have it.
That being said, why is the condition there to see if it has looped 100 times before doing the visa write??