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.
Solved! Go to Solution.
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.
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.