04-26-2016 05:18 AM
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.
04-26-2016 05:26 AM
Did I got it right?
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
04-26-2016 05:38 AM
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?
04-26-2016 05:41 AM
You should write false values into other terminals (in general - try avoiding leaving terminals not wired (set as default value))
04-26-2016 06:00 AM
Thank you, I understand it now ! 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.
04-26-2016 07:38 AM
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
04-26-2016 07:56 AM
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?
04-26-2016 07:58 AM
Isn't your whole program one big while loop?
04-26-2016 08:03 AM
Not really. Here is what the whole proram looks like.
04-26-2016 08:15 AM
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