Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggered Acquisition and Reading A Linear Encoder

I have an application where I am performing a triggered acquisiton of 4 AI channels, using PFI0 to kick it off. At the same time the acquisition starts, I need to read a linear encoder. Then when the acquisition is complete, I need to read the linear encoder again, then calculate the difference between the encoder readings. This difference is is a value, used in part of the analysis of the AI's.
 
From some reading, it looks possible using a counter on the DAQ card but I'm not sure of how to set it up, along with the task for the analog acquisition.
 
???
 
My system is:
PXI-8196 Processor
PXI-6120 S Series DAQ card. (I have two of these)
LV RT 8.2
 
Thank you in advance,
David
 
0 Kudos
Message 1 of 3
(2,984 Views)

Hi,

I would suggest breaking down your project into three parts. Let’s first get the 4 AI channels readings using the PFI 0 as the trigger. From your description you have couple of options for this part: N sample acquisition, programmatically stop the task, use a window trigger to stop the task or programmatically let the code read the 4 AI for an amount of time.  For that I would suggest staring from either: “Acq&Graph Voltage-Int Clk-HW Trig Restarts.vi” or “Acq&Graph Voltage-Int Clk-SW Trig Restarts.vi” these programs are included in the shipped examples.

After these part is up and running next step will be making sure we are able to read the values from the encoders so let’s get this code: NI-DAQmx: Reading the Position of an Encoder into a Buffer or DAQmx - Measuring Angular Encoder Position, even though is for angular encoder the connections to the counter are the same for a linear encoder, so channel A and B from the encoder will go to ctr0 source and aux respectively.

After that both of those codes are up and running take a look at the code attach and target it to your RT machine, the code attach is using a software trigger that you can change for a hardware trigger following the first example I pointed.

I hope it helps

Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 2 of 3
(2,970 Views)

Let me know if it helps



Message Edited by Jaime F on 01-18-2008 04:27 PM
Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 3 of 3
(2,970 Views)