LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable/disable physical channels

Solved!
Go to solution

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.

0 Kudos
Message 1 of 12
(4,252 Views)

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.

---------------------------------------------
Certified LabVIEW Developer (CLD)
0 Kudos
Message 2 of 12
(4,224 Views)

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 

0 Kudos
Message 3 of 12
(4,214 Views)

It looks like you are using two devices (cDAQ1Mod1 and Dev1); you won't be able to combine these in one task.

 

Snap24.png

 

mcduff

0 Kudos
Message 4 of 12
(4,212 Views)

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? 

0 Kudos
Message 5 of 12
(4,200 Views)

@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

0 Kudos
Message 6 of 12
(4,189 Views)
Solution
Accepted by Rarvizu

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:

readConfigs.png


GCentral
0 Kudos
Message 7 of 12
(4,156 Views)

This makes sense! 

 

Thank you all for the help!

0 Kudos
Message 8 of 12
(4,140 Views)

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 . 

0 Kudos
Message 9 of 12
(4,130 Views)

@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).


GCentral
0 Kudos
Message 10 of 12
(4,127 Views)