LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you set ChannelsToRead property to read different channels of a task in different locations/times?

I created a DAQmx task that has 4 channels in it.  Those 4 channels are all on one card (NI 9219) running in a cDAQ-9188 chassis.  In my application I have 2 different needs for the channels in the task. 2 of the channels continuously report back a signal I am using to monitor a system pressure once every 250 ms and I do not need to be acquiring at a high rate.  The other 2 channels I need to collect data at 100 Hz to do some analysis with (along with 2 other task acquiring at the same rate but I am not having problems with those).  I know that all channels in a task must acquire at the same rate, so when I configure the task I set the acquisition rate to 100Hz and on the 2 channels I don't need the high acquisition rate I just average the buffer I read to one value.  My question revolves around how my program is divided and how I execute the read of this task.  My program is divided into two loops that run in parallel, one for monitoring and one for DAQ.  I configure the task before entering both loops and then pass the task into each loop.  Before each read I use a DAQmx Read property node to set the ChannelsToRead property to the two channels in the task I want to read.  My problem is that when I run my DAQ loop, sometimes the read of the 2 DAQ channels returns no data.  I cannot figure out how there could possible be no data to read.  As I was thinking about this, a few additional question came to mind. First when I am not acquiring DAQ data, what happens to the data in the task from the channels that I am not reading.  Is the DAQmx Read vi actually reading that data from the buffer and just discarding the information from the channels not called out in the ChannelsToRead property, or does the data remain in the buffer ready to read when the ChannelsToRead property is so to read the data from those channels?  If the latter is the case, then why do I not get an error the states that I am attempting to read data that no longer exists?

 

I have attached a picture of what I am trying to accomplish in my program.  My actual program contains much more other logic and functionality that I did not want to clutter my issue.

 

Any help would be appreciated.

 

Eric

0 Kudos
Message 1 of 2
(2,548 Views)

Hi Gravy Train,

 

I'm curious about why you are using 2 loops.   You mentioned one is for monitoring and one is for DAQ....what do you mean by that?   What is the overall goal of this piece of code.   Also, I noticed that you are not closing the task.   Since this is just a subset, I realize you could be closing it in your actual code, but just in case you're not.....it is very important that you close all tasks when you are down acquiring data.

 

Best Regards,

 

Starla T  

0 Kudos
Message 2 of 2
(2,522 Views)