Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

cRIO unconsistent DAQmx read loops

Hello,

i'm kinda new to DAQmx acquisition and i'm having troubles with consitency with daqmx read iterations. I'll try to explain my hardware and ask my questions 1 by 1.

I'm using a cRIO with several DI/DO/AI/AO cards :

NI9202 (10kS/s/ch) 16 channels used (NI task : AI)

NI9208 (500 S/s/ch) 16 channels used (NI task : AI)

NI9208 (500 S/s/ch) 16 channels used (NI task : AI)

NI9203 (200kS/s/ch) 3 channels used (NI task : AI)

NI9264 (24kS/s/ch) 8 channels used (NI task : AO)

NI9476 32DO 500us 27 channels used (NI task : DO)

NI9401 8DI 100ns (NI task : DI)

NI9361 8DI (NI task : FREQ)

 

1) As you can see, i did set up a single DAQmx task called AI for several cards with different rates specifications. Is that correct to do this or should i set a task by type of card ? NI-max let me set up the AI task a 1kHz acquisition with 10 samples using onboard clock and continuous samples. My idea was : if I set up a single task (1kHz; 10 samples), then it would automatically synchronise the acquisition to 10ms even if the slowest card (NI9208, 16*2ms=32ms) would not have any update during several iterations. But i checked my loop timing and it's oscilating between 1ms and 36ms.  Is there something i'm missing ? I asked to read 10 samples (same as task configuration).

 

2) My DI read task is running in a different while loop and also has a loop timing oscilating between 1ms and 36ms. Why so ? Are DAQmx read tasks affecting eachother when running in different while loops ? In other words, are the tasks waiting for eachother to refresh their buffer or are they totally independent ?

 

3) I need to produce precise edges (between 1 and 100ms) on my DO so i send a buffer of 100 boolean values to my DAQmx  task as shown on the image. I was expecting the task to take 100ms each iteration but its oscilating between 90ms and 120ms with an error telling me "While writing to the buffer during a regeneration, the actual data generated might have alternated between old data and new data. That is, while the driver was replacing the old pattern in the buffer with the new pattern, the device might have generated a portion of new data, then a portion of old data, and then a portion of new data again. "

 

4) Before i had to use this buffer on DO task, i had every task in the same while loop but it was taking way too long to update my AI  because of the DO task being slow. This is why i decided to split my tasks in different while loops. Was it a good move or should i always gather the tasks in the same while loop as shown in the examples ?

 

Thanks a lot for reading and your help.

Download All
0 Kudos
Message 1 of 2
(2,108 Views)

Hello, 

Please find my answers bellow: 

1) There are multiple ways of synchronizing aquisitions cards. Please follow this link (EN) for further information.  
However, your acquisitions cards don't all have the same type of ADC :

9202: Delta sigma

9208: Delta sigma

9203: Successive approximation register (SAR)
In your case (one task for all cards), this applies:  "when a Reference Clocked Module and Delta Sigma Module are placed in the same hardware-timed AI task, the DAQmx driver routes the Reference Clocked Module’s reference clock to the Delta Sigma Module’s master timebase" (please refer to section 5 of the link above). 

2) Tasks (while loops) on the RT VI are never independent as they share processor time. It is mendatory to add a timing function (Wait until next ms multiple) in order to leberate the processor and give it time to accomplish other tasks while the first task is waiting. 

 

3) Try using non-regeneration mode (find out how in this link) to ensure that the data being output is not a mix of old and new data.
You could also try writing less data per loop iteration but at a faster rate. 

4) It's a good idea to seperate the aquisitions loops and the generation loop, espacially if they don't need to be synchronized. 

Regards, 

alexfalki

Message 2 of 2
(1,920 Views)