Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help incorporating the second counter into a current data acquisition routine (continuous retriggerable AI).

My current application acquires data when it sees a TTL trigger line.  Then it wait until the next TTL pulse and continues taking data until the user stop the data acquisition process.  I use "counter 0" as counter source.  The program works well.  However I need to read digital data everytime I take AI data.  I plan to use "counter 1" to read the digital data.  The trick is that I need to synchronize both AI and counter 1 readings. Therefore the counter 2 will acquire data when AI acquires data.

 

Here is the code I implemented and would like to know if it is correct.  The new code (implementation of second counter) is in the bottom part of the code.  I will really appreciate your help. 

 

Yajai

 

 

 

 

 

0 Kudos
Message 1 of 2
(5,309 Views)

Hi DrObb,

 

What is sounds like you want to do is to specify an external sample clock for your analog acquisition and a digital acquisition. Is there a reason in particular that you're using a counter? What hardware are you using? If you simply want to sample a digital and analog channel on the same clock edge, this won't be very difficult (provided your hardware supports hardware-timed digital IO). You can find an example of this being done in C by going to: 

Start » All Programs » National Instruments » NI-DAQ » Text-Based Code Support » ANSI C Examples and then navigating to  Synchronization\Multi-Function\ContAI-Read Dig Chan

 

Regards,

 

Sean

Sean Ferguson
Application Engineering Specialist | RF and Reconfigurable Test
0 Kudos
Message 2 of 2
(5,290 Views)