06-24-2011 11:04 AM
I am triggering several analog input / output tasks via a start trigger. How can I ask DAQmx after writing samples (a lot of them, up to 1e6) and starting the task when the tasks can be really started ?
I experienced errors (buffer underflow) in the analog output when starting immediately, and had to add a delay by hand to overcome them.
06-26-2011 03:04 AM
Can you please give more details ? How many analog inputs and outputs ?
Is it the same trigger to all Analog I/O ?
06-27-2011 02:32 AM
I have two DAQ M-series NI-6259 cards, RTSI on them.
I use the same sampleclock on AO and AI of both devices, created by the AO of device 1. This sanpleclock has a start trigger given by a digital; line of device 1 which I use as starttrigger for a scanning microscope setup, and also starts other hardware
the sampleclock is 10Khz, I have 2 channels on AO1 and 3 channels on AO2.
06-27-2011 03:08 AM
OK , in order to better understand how to use the DAQmx AO , AI in CVI you have a set of good examples ,
C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C
in there you have analog generation and measurement.
For example create a software which sets 1 ao & 1 ai at the same time by an external trigger that will give you better understating.
For each task use the Dodecahedra (DAQmxCfgDigEdgeStartTrig(gAOtaskHandle,triggerSource,triggerEdge)); function by that you will be able to set the entire system to same trigger.
06-27-2011 03:42 AM
The task configuration is not the problem, I have done this already.
I configure all the tasks with the external trigger, and then activate the external trigger.
If I activate the trigger in the code immediately after the Starttask commands, there is an error - if I wait some time after the starttask command (typically a few 100ms), it works.
How can I find out how much data is available on the ao onboard buffer to check how much data has actually been transfered to the device ?
06-27-2011 04:06 AM
I see ,
I think that waiting or checking the buffer size it's not the best way ( I don't know if there is an option check the buffer size )
I simply use DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(gAItaskHandle,DAQmx_Val_Acquired_Into_Buffer,sampsToRead,0,EveryNSamplesCallback,NULL));
I'm defining to the Device the number of samples that I want him to receive when he receives it the simply transfer it to my buffer.
For example if I'll define 1000 samples and I have 10000 samples he will make 10 events....
Look for the DAQmxRegisterEveryNSamplesEvent example it's very clear and don't forget to consider the amount of channels you have.
06-27-2011 06:31 AM
This does not help as it only gives a callback after samples have been acquired
06-28-2011 12:16 AM
Well I'm working with few of the X-Series and other units with external triggers and I had no problems like that.
What you need to do is some debug to see which AO / AI making the problem and then face it's config maybe it's something with the clock.
Try to use it with only one AO & AI if you still have a problem then it's your definitions....
Also maybe some one of NI Engineer can give you better idea's.