Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

cDAQ-9184 AI DO

Solved!
Go to solution

Hell community,

 

I work on a NI cDAQ-9184 chassis with a DO module (NI 9474) and  two AI modules (NI 9215).

 

The task is to acquire analog angle measurement and generate a pulse train to trigger a Laser sensor. Attached please find my simple block diagram. 

The challenge here is how to synchronize the DO and AI. As a beginner in this field, I get several questions as follows:

 

1. For the multifunction synchronization, I need to route my Counter Internal Output to the AI task as a sample clock. In NI MAX I can find this source in Advanced Timing section. However, in Labview, this CtrxInternalOutput is not available within DAQmx Timing.vi.  Do you have any idea what might be the problem?

 

2. During the measurement, I got 6590 AI measurements and 6699 laser measurements which are triggered by the DO pulse train with a 500 Hz sampling rate. It seems that we do not get same amount of AI and DO. What might be the problem?

 

3. About such synchronization, in my understanding, we need to configure the same sampling frequency, the same same sampling clock and make AI&DO acquisition start together. Am I right? For the difference in the number of samples, is it possible due to AI&DO do not stop at the same time when I press stop in Labview?

 

Thanks for your help.

 

-sparkle 

0 Kudos
Message 1 of 4
(4,143 Views)
Solution
Accepted by sparklexiong

1.  The "advanced" terminals are hidden by default.

 

2.  There are two issues:

 

i.  You must start the AI task before the counter output task so that it is armed in time for the first clock edge.

 

ii.  To ensure you read the same number of samples as pulses generated, you would need to stop the counter output task and then make sure you read back all of the samples that were in the AI FIFO.

 

3.  See #2.

 

 

Best Regards,

John Passiak
Message 2 of 4
(4,112 Views)

Thanks John. I will test it when I am in the lab tomorrow. 

 

To ensure all the samples in AI FIFO to be read back, can you give any clue or comment? I remebered I read somewhere, there is a specific DAQ .vi for it. 

 

Thank you again.

 

Best Regards,

Yi

0 Kudos
Message 3 of 4
(4,104 Views)

It's actually a little tricky on the 9184 since the driver wants to group samples into packets for more efficient data transfers over ethernet.

 

Reading -1 samples will read all of the data that has already been transferred to your PC buffer, but anything on the hardware FIFO wouldn't be read.  

 

To initiate the transfer from hardware to the PC buffer, I believe you can read one sample more than what is currently available (in the PC buffer), then follow that up with reading -1 samples to get the rest:

 

Untitled 13 Block Diagram _2014-02-24_12-48-57.png

 

 

I don't have an ethernet chassis available to try anything out on though--I'd love to hear from somebody from NI if there is a better way to do this (it is really clumsy to have to do this as I have described).  You might see if TotalSamplesPerChannelAcquired (the DAQmx Read property) gives you a reliable way to tell the number of samples acquired without having to do what I described above.

 

 

The other option is if you know exactly how many samples you should be reading, you could just read that specific number.  You can't query the total number of pulses generated from the output task, but you could use a second counter to count them.

 

 

 

Best Regards,

John Passiak
Message 4 of 4
(4,099 Views)