LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case Structure - Time/Switch Controlled Waveform

Solved!
Go to solution

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.

 

Message Edited by _thomas on 03-10-2009 08:55 AM
0 Kudos
Message 1 of 3
(2,491 Views)
Solution
Accepted by topic author _thomas

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

0 Kudos
Message 2 of 3
(2,483 Views)
Thanks Sean, you gave me an idea.
0 Kudos
Message 3 of 3
(2,466 Views)