LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I force inputs to a certain value?

In my program, I have to inputs, both of which are booleans.  I'll break down what I want to do in the simplest form to avoid confusion.  When a user selects both of the inputs to be true, a counter begins and once the counter reaches a value, it needs to set both of those inputs back to false.  Seems like it's so easy but I can't figure out how to do it.  Thanks for any help.

 

Jeremy 

0 Kudos
Message 1 of 3
(2,507 Views)

Post what you have so far.

 

To require both inputs to be True, you will need a boolean AND function.  If that is true then it increments your value by 1.  If it is false, then it doesn't increment.  Then if the value is greater than/equal to your target, then another case structure runs and inside of that it writes to a local variable of the two controls setting them to false.  In the false case, it does nothing.

 

Of course you need to maintain the value of your counter between loop iterations, which means a shift register.

Message 2 of 3
(2,502 Views)

The attached does what you want.  It'll be worth your time to learn how the JKI State Machine works.  Once you learn it, you'll be able to write this program in <10 minutes.  If you don't take the time, you may not be able to understand how it works and you certainly won't be able to pass off the work as your own.  (Not that you'd ever do that.)

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 3 of 3
(2,473 Views)