Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

9403

Hello,

 

I am using a compactDAQ 9172 with:

  • 5 modules NI 9215
  • 1 module NI 9211
  • 1 module NI 9401
  • 1 module NI 9403

in order to measure analog ( voltage and thermocouple) and digital inputs.

 

I have to create 3 tasks with  C++(Visual 2008) and DAQmx 8.5 functions:

 

  • 1 to measure analog inputs (voltage with NI 9215 and thermocouple with NI 9211)
  • 1 to measure digital inputs from NI 9401
  • 1 to measure digital inputs from NI 9403

 

 

The sampling rate for digital inputs (NI 9401) should be 20 kHz. As it is written on the documentation I can connect the  AI Sample Clock on this module to make continouous acquisition (slot 1 to 4).

In that case is it possible to have a different sampling rate for analog inputs (NI 9215) and digital inputs (NI9401) ? or is it necessarily the same?

 

Concerning measurement with NI 9403. it is only possible to measure samples one by on. if i want a specific sampling rate Shoud I do it in my C++ programm?

 

Is it possible to launch all the tasks in the same loop even if I should create a specific sampling rate for digital inputs of NI 9403?

Is there an another way to do it?

 

Thanks for your answers

 

Carine

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

Hi Carine,

 

You have to understand how DAQmx works. When you're making an acquisition, samples are buffered by the driver. In fact, there is two buffer: a small one in the board - here the CompactDAQ backplane, and a larger one in RAM. The driver will handle for you all transfers from the board to the RAM. So depending on the sample rate of your acquisition the RAM buffer is filled more or less quickly (the size of the buffer is automatically handled by the driver depending on the sample rate).

 

Then, in your program, you use the DAQmx Read function. This function empty the RAM buffer of a cartain amount of sample (you can set to read every avilable samples or a defined amount of sample). So to answer one of your question, it is possible to read differents tasks, with different sample rates in the same loop.

 

If you are using the AI Sample Clock as clocking source for your digital input, the sample rate of your Digital Input task will be the same as your Analog Input task. But you can use the property node Sample Clock:TimeBase Divisor to specify a number of Sample Clock Timebase pulses needed to produce a single Sample Clock pulse.

 

You can use this method for the NI-9403. You can define the sample rate using the DAQmx API, or use a single point acquisition. your program and the rate you call the DAQmx Read function will define the (software) sample rate of your acquisition. If all your tasks are in a loop clocked at 100ms, you will read 2k samples from you AI task, and you call DAQmx Read for th DI task on the 9403 (one sample) you will observe a sample rate of 0.1Hz.

 

Hope this helps,

0 Kudos
Message 2 of 3
(3,467 Views)

You can create a hardware timed task for the NI 9401 independent of your analog input task.  Hardware timed digital tasks on the cDAQ-9172 are correlated, which means they cannot generate their own sample clock  You can set the sample clock source to be the AI sample clock if you want your digital data correlated to your analog data.  Otherwise you will need to supply your own sample clock--the internal chassis counters are great for this.

 

The cDAQ-9172 does not support hardware timed tasks for the NI 9403.  You cannot enforce timing.  The best you can do is a software timed task.  You can read/write multiple samples at a time but it probably won't have the effect you're looking for.  It would end up being a bunch of reads/writes followed by a long wait followed by more reads/writes.

0 Kudos
Message 3 of 3
(3,456 Views)