LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

can't write to instrument in while loop.

in  my case, I use 2 while loop for the progarm. one is to write the data to the instrument, another one is use local variable to change the data depend on time. the problem is the data which need write to the instrument does change. but another while loop doesn't write it to the instrument unless I push highlight excution in the diagram or choose save as in the file. could anybody help me to find the problem?
0 Kudos
Message 1 of 3
(2,665 Views)

See if putting a 'wait (mSec)' function with a small wait time of 10-100 milliSec in each loop, will improve your VI's performance

Ha, for some reason I could not recall that word 'race condition' Smiley Wink

Message Edited by devchander on 08-22-2006 06:23 AM

0 Kudos
Message 2 of 3
(2,656 Views)
Hi Akuma,
the fact that it works when you highlight execution implies (perhaps) a race condition. The lightbulb serializes the execution of your VI, so that functions execute in succession although they don't depend on each other. When you then run the VI in realtime, some functions are executed at the same time, e.g. "VISA flush buffer" and "VISA write". It is important to define the order the VIs execute on your VISA interface for instance by wiring the error-cluster.
If this doesn't help, then post your VI (or a simplified version) or a screenshot of the diagram.
Greets, Dave
Greets, Dave
0 Kudos
Message 3 of 3
(2,654 Views)