03-10-2009 08:53 AM - edited 03-10-2009 08:55 AM
Hi everyone,
I'm building a time/switch controlled waveform. I have three different parts of waveform consisting of 8192 samples each. I have a Case Structure inside While Loop.
Case structure must have following properties:
- 1st line (from above) on output until Start is pressed. This is first part of waveform (normal state of signal) so I can repeatedly write this data.
- when Start is pressed, wait until current samples are written, after that write data from 2nd line exactly one time (this is a transient part of waveform)
- after transient waveform is completed, write stationary part of signal (3rd line)
- and finally, go back to 1st input line.
Case switching needs to be done after preceding data has been written because I need to synchronize beginning of one signal with ending of another.
Every help would be greatly appreciated.
Solved! Go to Solution.
03-10-2009 09:21 AM
Thomas,
I have done something similar before. I handled it by putting the waveforme write and play into a loop (with a case structure defining what array to write to the daq card). That way, if there is no user action, a default waveform is always written to the card and played. When the user pressed a button, a boolean triggered a different set of cases (you would use the boolean to trigger a simple state machine that determines what array to write). The final value of the state machine returns you to your initial state.
Example:
State 00: Normal state running default waveform
State 01: User action to start -> runs "line 2" -> change boolean to go to state 10
State 10: runs "line 3" -> change boolean to go to state 00
State 11: {unused state}
The only section that this should affect is the actual array write to the daq card (i.e. keep the rest of the code out of the state machine, but within the main loop)
I hope that helps,
Sean
03-10-2009 02:23 PM