LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically Create n number of sequential operations

Basically what I am trying to do is programmatically create "n" number of "Daqmx create channel" controllers based on user inputs. Currently I had to create manually three channels and wire them to the sample clock for data acquisition. My idea is to ask the user for how many channels does he want, say n and the VI should programmatically create n number of sequential channels and wire them automatically to the sample clock for DAQ. 

Labview Learner
0 Kudos
Message 1 of 12
(3,797 Views)

Hi,

the easiest way would be to do that in a For Loop.

Could you explain what is the overall functionality you want to achieve? I have a feeling there is a much simpler way to do it than dynamically creating channels.

0 Kudos
Message 2 of 12
(3,781 Views)

Are all of these channels on the same device?

 

You really should be setting up 1 task that handles N channels.  Just use a FOR loop with Create DAQmx Channel.vi in it.  Use a shift register to hold the task reference so that each channel is added to the task.  I would recommend using Create DAQmx Task.vi and wire its task reference to initialize the shift register.  Then you only need to set the clock for a single task.


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 3 of 12
(3,778 Views)

What I am trying to do is create n number of DAQmx create channel Vis based on the user input which have unique channels assigned to each of the Vi but are on the same task. So if a user says he needs 3 channels. I want to create only 3 "DAQmx create channel" VIS linked tro the same task. 

Labview Learner
0 Kudos
Message 4 of 12
(3,775 Views)

Here's how I typically do it.  You could change it some to autogenerate what channels to use.  I normally read task information from a configuration file and I therefore have an array of channels to add to the task.


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 5 of 12
(3,768 Views)
The for loop is the correct answer. Since you are a beginner, an easy easy to get an example is to create a multiple channel DAQ Assistant and convert that to LabVIEW code. The code will have for loops with array inputs that control the number of iterations but it's an easy modification to disable the auto-indexing and use a count.
0 Kudos
Message 6 of 12
(3,767 Views)

No they are not on the same device. What I am trying to create is extract channels from different devices. So the inputs may contain analogs, digtals, signals etc. I want to create n number of DAQmx Create channels- (same tasks for the same device). So every channel has its own data stored and plotted on the same waveform graph.

Labview Learner
0 Kudos
Message 7 of 12
(3,761 Views)

Thanks for the Vi. I will try it out and let you know How did it go.

Labview Learner
0 Kudos
Message 8 of 12
(3,753 Views)
Your statement does not make any sense. You cannot have different devices or different types on the same task. An analog input/analog output/digital input/digital output/ would require 4 separate tasks. Analog input on device 1 and analog input on device 2 would typically require 2 tasks.
0 Kudos
Message 9 of 12
(3,748 Views)

Yes, you are right. I am sorry, I meant, I am trying to use different tasks for different devices. 

Labview Learner
0 Kudos
Message 10 of 12
(3,744 Views)