LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Active/Enabled Channel Control

My question is twofold. First is there a way to tie in the channel number of an active channel (per the DAQmx Assistant or enabled with a boolean button) back to a "convert from Dynamic data" so that I dont have to manually change code everytime my channel configuration changes (see Fig 1). Sorry for the Icons, the snippet screenshot did that.

 

Second, is there a way to cleanup this snippet to be in a For Loop and link the in the number of active channels into N so that this bit of code is simplified and easier to read? I saw an example somewhere in the forums like in Fig 2.

 

I would appreciate explanation or examples. Thanks!

 

Enable Number of Channels.png

 

 

Channel Loop.png

0 Kudos
Message 1 of 13
(2,974 Views)

Im surprised nobody has responded. I'll ask again, does anyone have an explanation or examples to help me out?

0 Kudos
Message 2 of 13
(2,931 Views)

Hi TEmran - When you say you're changing your channel configuration, are you changing the actual devices in your setup? If so, unfortunately there won't be anything you can do as far as tieing those channels in to the Convert from Dynamic Data nodes.

 

If not, you could try taking the (Waveform) array into an Index Array and then into Get Waveform Components in order to parse the array and retrieve the channel. I'm not 100% sure about this method but it might be worth a try.

 

As far as cleaning up your code, it looks like what you have provided in figure 2 will certainly work, although I'm not so opposed to your code's current configuration.

 

 

David H.
National Instruments
0 Kudos
Message 3 of 13
(2,917 Views)

@David-H wrote:

Hi TEmran - When you say you're changing your channel configuration, are you changing the actual devices in your setup? If so, unfortunately there won't be anything you can do as far as tieing those channels in to the Convert from Dynamic Data nodes.

 

If not, you could try taking the (Waveform) array into an Index Array and then into Get Waveform Components in order to parse the array and retrieve the channel. I'm not 100% sure about this method but it might be worth a try.

 

As far as cleaning up your code, it looks like what you have provided in figure 2 will certainly work, although I'm not so opposed to your code's current configuration.

 

 


While all my devices are 4-20mA instruments, they do change on a regular basis. For the sake of saving time and money, Id rather have one interface that I can manipulate to change my configuration each time. So far Ive had to manually change the code everytime channels and instruments change - which is a real hassle. Since I will be working with at least 15 channels on an upcoming project...Id like to streamline the code to be able to adapt it to N number of channels.

 

0 Kudos
Message 4 of 13
(2,911 Views)
Then don't use the DAQ Assistant.
0 Kudos
Message 5 of 13
(2,904 Views)

@Dennis_Knutson wrote:
Then don't use the DAQ Assistant.

How would you suggest I do it then? Can you give me an example?

0 Kudos
Message 6 of 13
(2,900 Views)

In LabVIEW, go to Help->Find Examples.  This will open the Example Finder.  Do a search for "Voltage - Continuous Input" to find a decent example.  It should be at least enough to get you started.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 13
(2,893 Views)

Thats definitely not what I was looking for. I already know those examples (hence the reason why I have thus far gone with the DAQmx Assistant - its less cluttered). What I was asking is an example for measuring the 15 current channels and have them logging with different scales all at the same time, without cluttering my block diagram. Thats the whole point behind asking for input on the FOR loop.

 

This is what I was thinking in my head...but Im open to less complicated versions.

 

MultiChannel_Loop.png

0 Kudos
Message 8 of 13
(2,891 Views)
That won't work. You can't create an array of tasks. You need a shift register to operate on a single task. The channel ranges, etc. Can be arrays that you pass in from outside the loop and the for loop auto-indexes the arrays.
0 Kudos
Message 9 of 13
(2,879 Views)

You want something like this...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 13
(2,871 Views)