LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel processing in a state machine, help a semi-newbie out...

To simplify my problem:

1.  I have two buttons and a string indicator on my front panel.
2.  My code contains a state machine.
3.  In state X, I need to update the string indicator with a new string once every second UNTIL one of the buttons is pressed.
4.  When one of the buttons is pressed, I need to switch to a different state, depending on which button was pressed.

I'm having trouble coding the parallel processing part of this.  I have the code to update the string indicator once every second and I have the code to switch to a different state depending on which button was pressed.  But I can't get them to work together so the updating of the string indicator immediately stops and moves to the next state when either button is pressed.

Any thoughts?
0 Kudos
Message 1 of 7
(3,249 Views)
Use an event structure. Update the string indicator in the timeout case(state X).  Have two more event cases for the button value changes. Do you stays in the button states or do you go back to updating the indicator??
0 Kudos
Message 2 of 7
(3,238 Views)
State X, where the string indicator is being updated, is essentially waiting for the user to press either button.  After that, the state diagram moves to another state.
0 Kudos
Message 3 of 7
(3,235 Views)
Could you elaborate a little more on your suggestion of using an event structure?

The string indicator is only 8 characters long, and it needs to display a three part message to the user until they press a button.  So, the indicator would read something like:

Message A
(1 second delay)
Message B
(1 second delay)
Message C
(1 second delay)

And then repeat with Message A again.

When the user presses either button, the message display needs to immediately stop and move to another state.
0 Kudos
Message 4 of 7
(3,231 Views)
0 Kudos
Message 5 of 7
(3,201 Views)

This might be slightly closer to what you might be expecting.

Regards,

Chetan K

Application Engineer

National Instruments

 

Message Edited by CKap on 07-10-2006 03:21 PM

Message 6 of 7
(3,188 Views)
You may find the Producer Consumer architecture more efficient for this.

I have attached a quick solution. I applogize for the documentation (or lack there of), but I have a meeting to get to.

Post any questions and I will answer them as best I can.
0 Kudos
Message 7 of 7
(3,173 Views)