LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using USB 6009 to acquire two sets of data (analog) with different read configurations

Solved!
Go to solution

I am trying to acquire two sets of data with the USB 6009: analog voltage from a counter with a switch voltage of 3V and analog voltage from a 10k lbf load cell wired with an in-line signal conditioner. I've attached a screenshot of the part of the code I'm having trouble with. For the counter, I'm using a single channel, single sample read function, and for the load cell, I'm using a single channel, multiple samples read function. 

 

It seems that the DAQmx Task that I set up is only feeding the channels to the two DAQmx Read vi's once, then I run into error -200428: "Value passed to the Task/Channels In control is invalid. The value must refer to a valid task or valid virtual channels." Is there a function I can use to separate the two read tasks? 

 

Thank you in advance for any help!

0 Kudos
Message 1 of 5
(2,136 Views)
Solution
Accepted by topic author llim

The *immediate* problem is that the DAQmx Read function needs the *task* wire coming out of the top right of your DAQmx functions, not the *channel* wire that happens to have the same color but is a different kind of thing.

 

But there's another *important* problem lurking.  You should make 1 call to DAQmx Read to get both channels of data at once.  Either use the "2D DBL NChan NSamp" or the "1D Waveform" version of DAQmx Read.  Then separate the data for each channel *after* reading.

 

The way you're trying to do things now is going to lead to errors that you aren't catching.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 5
(2,109 Views)

Another potential problem, get rid of your milliseconds to wait; the acquisition rate should control the loop rate.

 

mcduff

 

PS: As Bob Schor once said "Show me the code." You will get better help.

0 Kudos
Message 3 of 5
(2,103 Views)

Thanks Kevin! I had suspicions that the DAQmx Task Channel node wasn't doing what I needed it to do. Changing it back to Analog 2D DBL NChan NSamp seems to work for the load cell, but it unfortunately doesn't fit in with the counter, because the switch voltage for the counter was programmed to take one sample as a true/false condition for another case structure. Is there a way to change the output post-DAQmx Read function to have just one sample?

0 Kudos
Message 4 of 5
(2,096 Views)

Never mind, I've used the mean function and it seems to be working. Thank you so much!

0 Kudos
Message 5 of 5
(2,093 Views)