LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fast array building from two independent acquisitions

Hi all,
 
I'm trying to figure out a way to build an array very quickly (up to 5 kHz) from two independent acquisitions.  For the two acquisitions I have a counter input from an encoder and a normal analog input, the purpose is to correlate with high resolution a position to an output voltage.  I can run each independently fast enough, but the problem I'm having is figuring out how to line up the two signals into a single array simultaneously and at a consistent rate (5 kHz) to write out to a file.  My first hack was to read the two outputs into a while loop clocked by a wait timer, but the best I think I can do there is a 1 millisec wait which gives me no better than 1 kHz.  Any ideas?  Hopefully something simple I'm overlooking.  Running LabVIEW 7.1 on a PCI-6036E card.  Thanks in advance.
0 Kudos
Message 1 of 6
(3,132 Views)
You're going to have to use hardware timing on the DAQ card and acquire multiple samples on each scan.

If you're using DAQmx (and you really should be), change the Read VI to acquire multiple smaples from multiple channels. This single VI can scan both channels and output a 2D array with each channels data in one row of the array.

You'll also need to change your configuration setup to specify both channels and the smapling rate.

If you look in the Example Finder (Help menu>Find Examples...) double click through "Hardware Input and Output">"DAQmx">"Analog Measurments">"Voltage" you'll see several examples that do this sort of measurment. Most of them only show how to acquire a single channel, but can be easily modified to include a second channel.

Let us know if you need more help.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 6
(3,122 Views)
Thanks Ed, maybe I'm not following the suggestion correctly, but I think the idea doesn't address how to merge the counter measurement with the analog input voltage, which merge is the fundamental trouble I'm having.  The DAQmx Read.vi allows me to choose either Analog Input or Counter but not both simultaneously, does it?
0 Kudos
Message 3 of 6
(3,117 Views)
Sorry,

I missed the fact that it a counter and an analog input, I was thinking two analogs.

For your counter, all you're reading is a count from an encoder?

I'll have to think on this one for minute.


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 4 of 6
(3,112 Views)

No problem, sorry if I wasn't clear on the initial question. 

Yup, bringing in a buffered counter on PFI 8 and up/down logic on P0.6 and doing some minor counts-to-angle conversion in a while-loop.  Currently, I'm running this as fast as it will go and desiring to sample the output from it at the desired AI rate to combine it to the analog voltage input.

0 Kudos
Message 5 of 6
(3,106 Views)
There's an example VI named "Multi-Function-Synch AI-Read Dig Chan.vi" that syncs the reading of an analog input and a digital input. You can find it in the Example Finder under DAQmx>Synchronization>Multi-Function.

This should give you a good start on what you need to do. It's easier to just look at the example than try to explain it. You should be able change the digital input to a counter with not too much trouble.

Hope that helps.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 6 of 6
(3,101 Views)