|
Re: paper: Programming in LabVIEW: Tips and Tricks
About Threading:
You would create a VI for each subsystem (not necessarily each thread)
Then you would call the VI from under the main loop (where Vision and Periodic Tasks is)
Then, in each VI, you would add one or more While loops (for each thread)
Each While loop will run in parallel.
You can then use Wait Ms to time the loop, somewhere between 20ms and 50ms is average (remember: the main loop runs at *around* 50ms ish, and has no exact means of timing.)
If you do not include Wait Ms, then the new thread will consume all of the remaining CPU power, cause possible network lag, and make it impossible to determine actual CPU load. Include the Wait Ms or another source of delay (e.g. wait for occurrence from the comm packet, or a camera wait for image) in every loop.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor
"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
|