Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggered Acquisition

I have an encoder that measures crank angles on engines at 360 ticks per rev or 720 ticks per rev.  I need to take a reading at every tick and store that data in a buffer.  The built in triggered acquisition requires a number of samples and a sample rate.  If you only run that aquisition once, it is easy to grab the data, but if it has to run a several thousand Hz and only needs to take ONE reading per tick you run into a problem of how to get data.
 
I need some sort of triggered interrupt where some code executes when a digital channel goes high OR I need some way to take one reading at every clock pulse and store that data to an array or a file.
 
What is the best way to do this?
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 1 of 4
(3,511 Views)
SCXI,

If I understand you correctly, you only want to take a single analog sample on each pulse of your encoder. Rather than use a triggered operation, try using this pulse as the sample clock of a basic continuous analog input task. Simply specify your sample clock source to be an external PFI line, then set the rate to the expected frequency of the signal coming from your encoder. This allows DAQmx to size the buffer appropriately. Please let me know if you have any questions.

Hope this helps,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 2 of 4
(3,502 Views)
Is there a sample project that uses an external clock?
 
Thanks a lot1
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 3 of 4
(3,500 Views)
HI SCXI,
 
I would check out the examples that ship with the DAQmx driver.  I found some good ones in the C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage directory.  These examples were written in ANSI C, but they still show how to set up the function calls for an external clock.  There are also VB examples installed under C:\Program Files\National Instruments\MeasurementStudio\VB\Samples\DAQ.
 
If you want more examples, a great place to look online is the Example Code Library
 
I hope this helps!
 
Justin M
National Instruments
0 Kudos
Message 4 of 4
(3,477 Views)