LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error between sub vi's- timing

I just want to let anyone know, who had errors when executing a sub vi within a vi and but no error when executing sub vi on its own, that it can be due to a timing issue. I solved this problem with a case structure at the beginning of teh sub vi with a slight time delay. This case structure forced the sub vi to wait before executing. Apperently this is what the program needed.

Hope this helps someone, it saved me!

IBAHKA
0 Kudos
Message 1 of 4
(2,770 Views)
This sort of error is usually caused by something not being quite initialized yet. It can also be caused by dataflow execution order problems (if things are not explicitly connected by a wire, there is no guaranteed execution order). This is very easy to do in LabVIEW, since LabVIEW is inherently multi-threaded. I would strongly recommend you find out why you need the delay and solve the problem cleanly. Otherwise, the delay you set now may not work on other (faster or slower) machines. Good luck.
Message 2 of 4
(2,752 Views)
Hello,

DFGray is correct in saying that the problem can be caused from the data not reaching the subvi before it executes. This is because of multithreading and dataflow. Here is a link to describe how LabVIEW works in terms of multithreading and programming suggestions for how to execute in order and to set priorities for subvis.
http://zone.ni.com/devzone/conceptd.nsf/webmain/d2e196c7416f373a862568690074c759?OpenDocument#3

Thanks,
Caroline
National Instruments
Thanks,
Caroline Tipton
Data Management Product Manager
National Instruments
0 Kudos
Message 3 of 4
(2,733 Views)
... and the most important passage from that doc is,

"In most cases, you should not change the priority of a VI from the default. Using priorities to control execution order might not produce the results you expect. If used incorrectly, the lower priority tasks might be pushed aside completely. If the higher priority tasks are designed to run for long periods, lower priority tasks do not run unless the higher priority task periodically waits."

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 4
(2,725 Views)