LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing Data within while loops

I have LabView 6.0
I have a while loop for my GUI that accesses various sub VIs. One of the Sub VI is a LED on/off thing, which basically checks the communication with the PIC board that I have. For turning the LED on or off, I have to sent a unique command.
Since the Sub VI for the LED on/off is inside a while loop it continuously executes. I want the SubVI to execute only when the status of the boolean controlling the LED has changed from the previous value. I tried giving a feedback from the SubVI to indicate whether there is a change, but Labview will not allow such loops.
I then took the SubVI outside the while loop, keeping the boolean control (so that it continuously checks) inside the while loop. I would like the SubVI to execute depending on the boolean control change. I tried using occurances, but I think these execute only once. I tried accessing the boolean control through a local variable, but the value of the local variable would not change outside of the while loop. (even tried property indicators).
Any solution would be appreciated.
I could post the VI, but there are too many sub VIs... Dunno if it would be appreciated.
Thanks!
0 Kudos
Message 1 of 6
(3,147 Views)
Use a shift register in your loop with a case structure around the subvi...

Although I'm not exactly clear as to how the LED changes...  Are you saying that the subvi you want to change the execution status of, determines whether it will execute again?  Is the determination of led value done in the loop, but not in the subvi you want to conditionally run?

You could just post a picture of the code in question...  (jpg, png...no bmp please)
0 Kudos
Message 2 of 6
(3,137 Views)
If you need to post a VI, it is best to strip out those parts which do not have any effect on the problem you are facing. With subVIs, do a Save with Options..>>Development Distribution. This will create an .llb file with your VI and subVIs.

Queues and global variables can transfer data between independent nodes. I am not sure when the datatypes of queues changed. In LV6 you may need to flatten your data to string typpe before passing it to a queue. The functional global or LV2 style global is a subVI consisting of a loop which executes only once and which contains the data in an uninitialized shift register. Many threads on this forum have discussed these options.

Lynn
0 Kudos
Message 3 of 6
(3,134 Views)
I am attaching the VIs and the corresponding Sub VI
0 Kudos
Message 4 of 6
(3,129 Views)
See attached modification of your VI for an edge detector implementation in LV6.

Lynn
0 Kudos
Message 5 of 6
(3,121 Views)
Dude ! You rock ! Thanks .. Spent about a day on this .. guess I learn a lot too! Thanks again!
0 Kudos
Message 6 of 6
(3,117 Views)