02-25-2020 02:33 PM
Hi all,
I am using a NI USB-6009 to read analog channels, 4-20 ma signals. Every signal has a different 4-20 ma scale, for example 1 channel might be a 0-15000 psi pressure transmitter, another channel might be a 0-15 GPM flow meter and so on. I am trying to figure out how to turn channels on and off, in case I use use 1, 2 or 3 channels out of the 4 analog channels on the USB-6009.
I am fairly new to Labview, any advise would be greatly appreciated.
Thanks.
Solved! Go to Solution.
02-25-2020 03:22 PM - edited 02-25-2020 03:23 PM
First, I have used quite a few USB-6009 in the past, and I am pretty sure they cannot measure 4-20mA directly since they are voltage (not current) inputs. I highly recommend you double check the specs of the USB-6009!
Second, I am not sure why you would want to "turn off" channels. Simply read the channels you are interested in and ignore the others. There is a great articular on getting started with Daqmx, unfortunately my google-fu is not very strong atm. The LabVIEW examples are another great source to look into.
Hope this helps.
02-25-2020 03:38 PM
I am using a known resistor across the input to calculate voltage. Eventually I am going to be recording the channels being used, and I do not want to record the ones not being used.
Thank you
02-25-2020 03:45 PM
It looks like you are using two devices (cDAQ1Mod1 and Dev1); you won't be able to combine these in one task.
mcduff
02-25-2020 03:56 PM
Sorry I selected the wrong channel, it should've been Dev1/ai0. Is there a way where you can select the channels you want to be record?
02-25-2020 06:05 PM
@Rarvizu wrote:
Sorry I selected the wrong channel, it should've been Dev1/ai0. Is there a way where you can select the channels you want to be record?
In the VI you posted you are selecting the channels you want, so I guess I don't understand your question.
mcduff
02-25-2020 10:57 PM - edited 02-25-2020 10:59 PM
The article that I think was mentioned earlier is probably this one (confirmation? 🙂 ) : Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications
I guess in terms of selecting channels, you mean you want to wire your sensors to specific input terminals, and then associate appropriate scaling to a physical terminal, and choose based on either selected terminals or selected "types".
I'd suggest some sort of lookup subVI, that outputs a cluster (or better, an object if you're comfortable using OOP) of the scaling parameters needed (m and c if linear, i.e result_value = voltage * m + c) along with the physical channel, when given an input "enum" value for type.
This allows you to pass an array of enum values to the subVI in an autoindexed For loop and get the properties, build a task with each channel added (configuring them differently if needed) and then scale them in your Read loop.
Possible (very very crude) example for the lookup:
02-26-2020 08:26 AM
This makes sense!
Thank you all for the help!
02-26-2020 08:54 AM
I am sorry, I failed to mention that I wanted to build an executable, that would allow the user to select any combination of the four channels.
Thank you .
02-26-2020 08:57 AM
@Rarvizu wrote:
I am sorry, I failed to mention that I wanted to build an executable, that would allow the user to select any combination of the four channels.
Thank you .
The same method should work. Was there a problem, or was that a reason behind the choice you made now?
If you place a control on the front panel (array of enums, array of physical channels, even a single DAQmx channel with the use of DAQmx Unflatten Channel String to get individual channels for your lookup) then you can define it at runtime.
You might want to use a State Machine or similar to have a pre-initialization of channels state (to allow time to select the values, etc).