04-11-2005 10:30 AM
04-12-2005
02:29 PM
- last edited on
11-13-2025
04:01 PM
by
Content Cleaner
I'm having some trouble following your code, but an obvious problem is the fact that your event structure doesn't have a timeout. This will actually cause the second loop to iterate only when the event occurs because the program will stop and wait whenever it reaches the event structure unless the event occurs. In general, user interaction through events is best confined to one place.
To pass the value to the last loop, you probably don't need a variable, but just to wire the value from the second loop to the third loop. If you do want a variable, you can use the LV equivalent of a variable, which is a local variable. A local allows you to read and write to a control's value from several places. You should use them only when necessary because when used wrongly, they can easily cause race conditions. You can use a local to turn your LED on and off. Simply right click it and select Create>>Local Variable. Then, place the local anywhere you like and wire T or F into it. Copy the local by using ctrl+drag. This will show you how easily a race condition can occur. Since you're writing to the local from several places, you have to make sure they can't occur in parallel
I hope these thoughts helped you along. If not, don't be afraid to post more questions.
To learn more, I suggest you read the LabVIEW user manual. Also, try searching this site and google for LabVIEW tutorials. Here is one you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide.
04-17-2005 05:23 PM - edited 04-17-2005 05:23 PM
Message Edited by Dominj on 04-17-2005 05:31 PM
Message Edited by Dominj on 04-17-2005 05:32 PM
04-17-2005 09:17 PM
04-18-2005 01:32 PM
04-18-2005 02:09 PM