From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structures: how to stop event case from occurring during timeout

Hi,

 

I am trying to make a program in LabVIEW for a project I am working on but I am completely new to the area of programing and LabVIEW so I am sorry if my question is stupid or the answer is obvious. 

Right now I have a problem trying to make the event structure work as I would want it to. I have added a case to perform a task (light up LED lamps) when sertain consitions are activated and another case for what happens when time out occurs (light another LED lamp). When time out occurs the LED light that I want to turn on turns on just fine but I want the LED lamps connected to the other case to turn off, they still remains on. I thought when time out occurs only the time out case will be active and not the "event case", is there anyway to only have the time out case active when time out occurs? I hope my explination makes sense. 

0 Kudos
Message 1 of 13
(4,424 Views)

Did I got it right?

Led.png

PS: This i Snipped - it's a .png file, that you can drag and drop on your BD to insert the code that is presented as functional LV code

0 Kudos
Message 2 of 13
(4,417 Views)

It is something simelar to what you did, it is just a little bit more complicated which I didnt really explain before. I also have a case structure within the even structure and there are some other structures as well between the LED's and the event structure. I think maybe I realise my mistake now, do I need to include all the structures in the time out case as well and just give it a false value to make it work? 

time out.PNGEvent.PNG

0 Kudos
Message 3 of 13
(4,411 Views)

You should write false values into other terminals (in general - try avoiding leaving terminals not wired (set as default value))

0 Kudos
Message 4 of 13
(4,404 Views)

Thank you, I understand it now Smiley Happy !  I just ended up with some other problems so I think I might have to reconsider the whole thing to make it work.  I somehow need to stop the signal sent to the LED's when time out is happening but that would also end up messing up with the rest of my program.  

0 Kudos
Message 5 of 13
(4,391 Views)

It sounds like you may need shift registers to pass the value of the booleans from one iteration of the loop to the next. Wire them straight through the event cases where they do not change.

 

Lynn

0 Kudos
Message 6 of 13
(4,368 Views)

Shift registers only works for while loops and for loops i think? So you are sugesting to add a while loop around the event case? 

0 Kudos
Message 7 of 13
(4,358 Views)

Isn't your whole program one big while loop?

0 Kudos
Message 8 of 13
(4,354 Views)

Not really. Here is what the whole proram looks like. 

 

program.PNG

0 Kudos
Message 9 of 13
(4,347 Views)

Any program which does more than one very simple thing usually should be inside a loop. 

 

Do NOT use Run Continuously to run a program multiple times.  That option is only for testing and debugging code segments which are not part of a loop.

 

Once you put your code inside a while loop, add a Stop button wired to the Stop if True continuation terminal, and connect your booleans to shift registers, then thisg may start to work the way you want.

 

It is very helpful to write down exactly what needs to happen when each user action occurs (such as pressing one of the buttons) or other conditions develop (such as timeout). This can be in the form of text or a flow chart or state diagram. A well developed design or plan makes it much easier to get the program to do what it needs to do.

 

Lynn

0 Kudos
Message 10 of 13
(4,334 Views)