10-02-2018 03:21 PM
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!
Solved! Go to Solution.
10-02-2018 05:39 PM - edited 10-02-2018 05:42 PM
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
10-02-2018 06:03 PM
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.
10-02-2018 06:44 PM
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?
10-02-2018 06:49 PM
Never mind, I've used the mean function and it seems to be working. Thank you so much!