01-15-2013 03:58 PM
Hi!
I have a case structure with 3 states, and I need to select each state based on a time-dependent profile. For example, I would like state 1 to be on for half a second, and then state 2 to be on for 1 second, and so on; i.e. each state is on for a different amount of time for a total duration of 3 minutes. How do I create the input for the case selctor to accomodate these 3 states?
Thanks.
01-15-2013 04:04 PM
Use a typedefed ENUM to define your states. Use meaningful name rather than simply state 1, state 2, etc. Have an array or time values for each state. Use a shift register on your while loop to hold the time of teh last state change. Compare the difference in time from the currnet time and the last state change time and see if it is greater than your set time. If it is, go to the next state. If not, go to a check timeout state. You will need a shift register to hold teh next state as well. The state change will update the time on the shift register and set the timeouts.
01-15-2013 04:08 PM
There's not much in that VI. I recommend you start by reading about state machines, or create a new project in LabVIEW using the "Simple State Machine" template. When you enter a new state, track that time in a shift register, and when the appropriate amount of time has passed, advance to the next state. Give it a try, and if you get stuck, post again with your VI attached.