LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

toggle switch not toggling

Hi,

I have a couple of switches that I need to toggle while running a VI, but they are deeply embedded in the program and does not respond to toggling when they need to be used. They are in a while loop (which continues until one of them is set to true) and the while loop is in a timed sequence which is in a case structure which is in an event structure.

I have tried to place the buttons outside all structures and have local variables in the loop, and I have tried to have the acutal switches within the while loop, but they do not respond in either case.

Does anyone have a good suggestion on how to get them to be updated and read in the while loop?
0 Kudos
Message 1 of 9
(4,968 Views)
Hi Mathias,

the buttons surely respond, but are you sure your while loop is running? Maybe you have the loop inside the wrong event or in the wrong the case?
Have you tried to do some debugging using the "bulb"?

Message Edited by GerdW on 08-21-2007 11:34 AM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(4,961 Views)
Hi Gerd,

Yeps, The while loop is running and the switches are continuosly read in the loop.
0 Kudos
Message 3 of 9
(4,958 Views)
I think I am doing some obvious mistake of the same kind though, the switches can be toggled before I enter the event structure, but not while being in the while loop.
0 Kudos
Message 4 of 9
(4,954 Views)

Could you please send a small sample.vi? 🙂

How often a specific control is read out usually depends on where it's placed. And thus you usually want them more inside rather than more outside. 🙂

0 Kudos
Message 5 of 9
(4,948 Views)
Hi Mathias,

this is (maybe) due to disabling other events while executing one event:
There's a switch in the event properties window named "Lock front panel until event case completes" and you probably didn't switch it off!

This leads to the next point:
Usually you should only handle an event inside the event structure and do time-intensive tasks (processing|waiting for user interaction|etc) outside of this event structure! There's a reason for having this switch set on on default...

Message Edited by GerdW on 08-21-2007 12:07 PM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(4,944 Views)
Thanks Gerd, I am unfortunately sitting on the basic package of LV here so I cannot edit the event structure. I will need to change the event structure into something else it seems. Unless you feel like doing that switch in the event properties window and passing the VI back.   Smiley Tongue I will add the program just in case.

Martin, I tried to avoid that since it is pretty messy..


0 Kudos
Message 7 of 9
(4,934 Views)
Hi Mathias,

I removed the "Lock front panel" for the aquire event. Test if it works now, but again: events shouldn't take that long to prevent other events being stalled...
I also removed some of the local variables - use the terminal whenever possible!
And try to keep the diagram as small as possible, it should fit on the screen (I'm using 1280×1024 resolution).

Swedish, eh?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 9
(4,922 Views)
Thanks for your help Gerd, it works like a charm Smiley Happy

I will rememer not to use event structures for this kind of stuff in the future.

And yes, im a swede Smiley Tongue
0 Kudos
Message 9 of 9
(4,915 Views)