LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State Machine for DAQmx signal generation

Solved!
Go to solution

Hello.

I am using a state machine and DAQmx to generate custom signals. Two of the profiles (static and staticwalk) are straight forward. I am able to generate the correct signals and the program works as expected. I am having issues with the 'ETrip' profile. In this profile, there is an acceleration phase, a constant velocity phase until a certain number of events are detected, a deceleration phase, a wait phase, an acceleration to deceleration phase, and then the signal is complete, the program prompts the user for input and then it is ready to generate another profile.

In the ETrip profile, I start by writing a finite number of samples for the initial acceleration. I then switch to continuous samples for the constant velocity phase and then back to finite samples for the initial deceleration and then the acceleration to deceleration phases. I am not sure how to go between states to generate one smooth signal. I am getting errors with the Sample Clock and I am not able to generate the expected signal.

Thank you for your help.

0 Kudos
Message 1 of 3
(1,605 Views)

Your problem is that you are stopping and starting the task for each state.  You might want to consider using a Producer/Consumer setup where the AO is in the consumer loop and your state machine just sends the data to write to the consumer loop via a Queue.  This way you can have a single task that just continuously outputs data.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 3
(1,592 Views)
Solution
Accepted by topic author Miller37

I don't think you can switch between continuous and finite signal generation. I think you'll need to manually keep your buffer fed in your "continuous" phase, then start writing a new buffer when your Stop event is detected. Check out the "Continuous waveform non regenerating" example for a good way to do this.




Heads up! NI is moving LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 3 of 3
(1,590 Views)