10-13-2010 01:15 PM
So I've got a program and I want to be able to put a while loop in and run my clock in a continuous sampling mode but inside the loop tell my DAQmx read to only read a finite number after a trigger event. So I want to be able the DAQmx read to be monitoring the program watching for a trigger and when it gets a trigger to record a set number of samples and then go back to watching for another trigger. When we've run the program in finite and without the while loop we have to use the run continous instead of just run because otherwise it triggers once and stops the program, unfortunately the run continuous means that we have to initialize and stop the tasks each time which is very slow and we need the program to be as fast as possible, hence the loop, but we can't run the program with a while loop in finite sampling mode. Does anyone know how to do this? Thanks!
10-13-2010 03:54 PM
Hi hhuds,
Older boards (e.g. M Series, E Series) do not support retriggerable Analog Input tasks. They do however support Retriggerable Counter Output Tasks. You can use a retriggerable counter output as the sample clock for a continuous analog task to get the same behavior as a native retriggerable analog input task. See this example.
If you are on a board without retriggerable AI and you do not have two extra counters available (necessary to generate a finite pulse train on most of these boards), you can still optimize your performance a bit by explicitly committing the task before it is started like in this example. There will be some downtime during the software calls to restart the task, but explicitly committing the task before it begins will minimize those delays.
X Series boards do support retriggerable Analog Input tasks. If on one of these boards, you can simply set the Retriggerable property to true like in this example.
Best Regards,