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.
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.
05-11-2015 12:22 PM
I would like to have one (boolean) button change the state of several digital output lines (Picture attached):
Wit a button press, I want to create a short pulse (lets say 200ms) on lines 3 and 4 (simultaneously). After those 200ms, I want line 1 to switch states (let's say it was OFF until now, switch to ON), and line 2 doing the opposite (ON until now, OFF onwards). I would like each button press to create that short pulse on lines 3 and 4, and switch states on line 1 and 2.
This might be a simple VI, but I could not figure it out. I want this to go to a DAQ (USB 6211).
I hope I was able to explain it clearly.
Thank you bery much
Solved! Go to Solution.
05-11-2015 02:22 PM
What have you tried? Have any code to share?
This sounds to me like a simple state machine application. Keep the states of your buttons with a shift register and have the state machine go through your output states.
05-11-2015 03:59 PM
Yes, correct, I am using a state machine, trying to use it with a shift register.
Right now, I have four boolean buttons, one for each state.
I don't know what goes inside the state machine, i.e. how to wire everything. I am pretty lost, even when looking at examples and tutorials.
05-11-2015 06:33 PM
First, write down what states you will need, what you need done in each state, and how you want to transition from one state to the next. I am specifically referring to a State Diagram. Then we can start looking at code.
05-12-2015 01:41 AM
I have two states, both state toggled by a singled button. I have four variables in both states. S1 when button = true, S2 when button = false.
The transition between both states is to run c and d for 100ms each. I tried drawing it in the picture from the original post.
Thank you
05-12-2015 09:07 AM
Looks like my attachment didn't get uploaded in my last post. Here it is
05-12-2015 09:15 AM
@tuyenhoang7 wrote:
I have two states, both state toggled by a singled button.
No. Based on what you have said, you will want a state for each transition plus a state for checking for the user pressing buttons. Then you can check for the user pressing a button and starting up your new sequence.
05-12-2015 01:44 PM
Is checking for the button (whether or not the user has pressed it) a transition or a state? I have envisioned it to be a transition, so that each state would do something (or nothing), and the buttons would be the transitions (whether or not the button is pressed).
I am attaching what I think my state machine should look like. Please let me know if this makes sense.
S0 would be the initial state, doing nothing.
05-12-2015 02:13 PM
Checking of the buttons is a state. The state of the buttons being pressed or not causes a transition.
05-12-2015 04:02 PM
That makes sense. The diagram attached from my last post shows three states. Can checking the button could be part of the DO statement? Or does it need to be a separate state? The arrows/transitions would be the state of the buttons being pressed, with B = Y being 'button pressed', and B = N being 'button not pressed'.