01-26-2012 05:15 AM
Hi all,
I have a seemingly simple problem that has be quite stumped... Probably because I'm just being stupid...
I have a boolean signal that starts out false. This will be fed into a True/False case structure that will, when TRUE is triggered, run a simple VI once and once only. When FALSE, nothing will be run or output. Unfortunately, this true boolean signal will last for a quite a while when triggered (several hours in fact) and causes the VI in the true case to run over and over again... I just need it to run once and then ignore the true boolean signal (switch to and stay in the false case of the structure) until the input drops back to false and then re-reun the VI once if/when it goes back to true.
I wish I had a VI to upload, but my home computer does not have Labview installed.... I would GREATLY appreciate some help on this... Thank you in advance!
01-26-2012 05:45 AM
Hi,
If your code is simple, you can use a shift register with a case structure, and you can control the next state of your case structure from the shift register, on the other hand, if your code has some other states, it is recommended to use state machine. I prefer to use state machine.
Hope this helps
01-26-2012 05:51 AM
Would this work for you?
The blue VI should only run once for every time Signal goes True.
The VI will run if 'Signal' is True AND 'VI has run' wire is false.
When the VI has run, the 'VI has run' wire is set to True preventing subsequent runs.
When Signal changes to False, the 'VI has run' changes to false, making sure the VI is runned next time 'Signal' changes to True.
01-26-2012 11:47 AM - edited 01-26-2012 11:49 AM
Hi,
If I understand you corectly you are trying to run the sub vi on the +ve going Edge of the boolean not the level. If this is the case this can possibly be achieved by doing the following.
- wire "Signal" straight into a shift register on the RHS of the loop
- Expand the left hand shift register to give you "Signal i-1" and a "Signal i-2"
- write the logic such that [s-2=F and s-1=T] i.e a +ve edge
- use this OP to run the sub vi
Craig
01-26-2012 01:10 PM - edited 01-26-2012 01:12 PM
All you need is a globally initialized feedback node that remembers the previous state and a comparison.
The output of the following code is true whenever the boolean has gone from FALSE to TRUE and false otherwise. Use the output for your needs, e.g. to switch a case structure.