Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Read portion of DAQ output for each channel

I'd like to be able to start an analog input getting continuous samples of 8 channels at a given rate and at specified times read a portion of channel 0 and also read a portion of channel 1 not necessarily at the same time. The attached VI will hopefully give an idea of what I'd like to do.

Is it possible to read data from one channel while leaving the buffer intact so that another channel can be read before the buffer has to fill again?
The only thing I've been able to do so far is read all channels. When I do this it empties the buffer. If I then try to read from another channel, that read has to wait for enough samples to be available. I will miss out on the data I want from the second read.
This was messier to explain than I'd hoped so I hope someone can figure it out.

George
0 Kudos
Message 1 of 6
(3,377 Views)

Hi Geroge,

what you try in your example is not possible, because you will get the values of all channels ai0-ai7 in both loops. Why don´t you read in only one loop and depending on the control values of your boolean inputs you can decide which channel goes to which graph.

Why don´t you continue here?

Mike



Message Edited by MikeS81 on 05-22-2008 09:00 PM
0 Kudos
Message 2 of 6
(3,372 Views)
Sorry, I thought it was a different problem this time.

What I submitted was an oversimplified example and the VI didn't exactly represent what I really wanted to do. I deally I want to read from one channel in each loop, but I don't know how to do that or if it's possible. The sampling I want to do might overlap between channels. The sampling will be controlled by a timer in the real application. For example, say each channel is set to read 5 sec worth of data. The timer calls for channel 1 to start sampling. Two seconds later, the timer for channel 2 may call for that channel to sample for 5 sec. It seems that somehow I need independent buffer pointers to control where the read starts.

George
0 Kudos
Message 3 of 6
(3,368 Views)
You cannot do what you want. You have a single task with all of your channels so you will read all channels. If you attempt to create separate tasks with one channel in each task, you will get an error because you cannot run multiple tasks on the same resource. What you could probably do is sample all channels at a high rate and discard the unwanted samples.
0 Kudos
Message 4 of 6
(3,362 Views)
Sorry, but I don't quite see how faster sampling will help. When I do the first read it will clear the buffer (or reset the pointer I guess) leaving nothing for the second read.

I wonder if I could somehow use the "RealativeTo" node to do the read. There must be a way to manipulate the buffer pointers so that each time I want to read I can get the last x samples of data. I think that's what I really want to do is read the last x samples worth of data from the buffer each time I do a read.

George
0 Kudos
Message 5 of 6
(3,358 Views)

You can't have a second read. That's the whole point. If you want to sample channel 1 every 1 second and channel two every 2 seconds, you can do a read every second and discard every other sample of channel 2.

I'm not sure about the relative read function. I've never used it but you will still be limited to having a single DAQmx Read of all channels. As noted in a different thread that you started on the same subject, it's how the DAQ board is designed and how DAQmx is written.

Message 6 of 6
(3,354 Views)