03-05-2010 09:55 AM
Hi,
I have arranged the circuit seen in attached. At the moment the counter will change from 0 to 1 when the analogue signal from the DAQ changes aka the direction changes from false to true. However I want it to continue to count, 0 to 1 to 2 etc.
What can I do to achieve this?
Thanks.
Solved! Go to Solution.
03-05-2010 10:24 AM
Are you saying that once the condition is met once, you want the increment to continue even the conditon is not met on the next iteration? If so, you can create another shift register for your boolean, and for your case structure condition, you can put a Or gate there. The logic is as follow: if the boolean shift register is true or the subvi output is true, increment.
Yik
03-05-2010 11:26 AM
Yeah I want the counter to continue but only if the change from false to true occurs again. So false-true happens 5 times, the counter should show 5.
I'm abit of a novice with labview, and the explanation has left me a little confused, although I'm sure its me! Sorry. If the scenario I speak about above is the same as you have detailed a solution for, please could you explain it using an image, that would be great.
Thanks!
03-05-2010 01:26 PM
Your code should do what you want. I have attached a simulated version of your code. it should continue to count. I do have two questions for you though.
1. What is your false case? It seems like your have the option "use default value if unwired" turned on for the case structure output tunnel. If you don't have a through wire on the false case, you will mess up your counter.
2. Make sure that the subvi that is connected to the case structure is generating the correct boolean event.
Yik
03-05-2010 01:28 PM
If this psudo-code correctly explains what you want to do, use the attached code:
if (boolean[n-1] == false) AND (boolean[n] == true):
counter += 1
Hope that helps, let me know if that doesnt make sense.
03-05-2010 01:36 PM
Actually, I included an unnecessary extra step, you could do something like this: