Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ measurement programming problem

I have a problem with my DAQ measurement which i would like to have some advice on.

I have a single loop with DaqMX operation A, B and C running 'almost' together (perfect sync is not essential). Now i want to operation A to start acquisition maybe 10 or 20 samples earlier than B and C so that i can know the status of A before B and C comes in. How do i achieve that? Is it still possible within a single loop?
0 Kudos
Message 1 of 6
(3,504 Views)
Would this work? Loop A will start 10 samples earlier
0 Kudos
Message 2 of 6
(3,501 Views)
Sorry wrong image...this is the correct one
0 Kudos
Message 3 of 6
(3,502 Views)
Hi Atma,

Depending on what device you are using, the solution might be slightly different.  For example, if you're using one of our M series or E series devices, you can only use one analog acquisition task at a time because of the shared timing (these cards use a multiplexer to acquire from multiple channels).  If you have a card that supports simultaneous sampling (S-series, DSA boards, Digitizers, etc.) this may be different.  If you setup one task to acquire from all three channels and did your calculations on channel A and ignored the other channel values, would that work?  Basically, I would set it up so that during the first call in the while loop I could collect the number of samples (from all channels including channel A), do the math that you want on channel A, and clear the information from the channels you aren't concerned with yet.  I've attached a picture that shows how to use the "first call?" vi to setup a case structure to take the first setup of samples just once at the first iteration of the while loop.  I would also note that in my picture the task would already be started prior to the first call.  You might want to start and stop the task during the first call to allow modifications to be made to the task. 



I hope this helps,
Paul C.

Message Edited by Paul C. on 09-24-2007 10:37 AM

0 Kudos
Message 4 of 6
(3,460 Views)

Hi Paul, thanks for reminding me on the multiplexer, yes i'm using M-series daq card, but EXACT same instance measurement is not absolutely critical here, i guess a couple usecs wouldn't hurt.

Btw, another question. Normally the way i program is that i use 1 sample on demand setting in MAX and have the task looped multiple times within a while loop (with a few ms between iterations). How can i know what is the rate i'm sampling using this method?

Message Edited by ATMA on 09-24-2007 11:40 PM

0 Kudos
Message 5 of 6
(3,443 Views)
Hi Atma,

The way the code in the picture works is to basically sample at the specified rate defined by the DAQmx Timing vi.  The M-series DAQ card will grab samples at the specified rate and collect them on the buffer of the card until it sends the data to the PC memory through DMA channels (unless you have specified another data transfer mechanism).  While this is all occuring behind the scenes, you will be calling the DAQmx read.vi which grabs the data (depending on your DAQmx read settings this could be in the form of chunks of data or a single sample) from the PC memory to be used within your code.  The bottom line is that the card will be sampling at the rate specified by the DAQmx timing vi and collecting all these samples in the buffer.  This is independant of how fast you take this information from the buffer (which includes both the onboard M-series buffer and allocated PC memory) using the DAQmx read.  I hope this clarifies your question about the rate your sampling at. 

Thanks,
Paul C.
0 Kudos
Message 6 of 6
(3,421 Views)