LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically set NI DAQ physical channels

Solved!
Go to solution

If I read channel assignment from a configuration file (e.g. 9205 AI0:AI1), how can I create DAQ tasks using corresponding physical channels in labview?

0 Kudos
Message 1 of 6
(5,234 Views)

So far what I come up with is

1. create a string constant array with channel names that corresponds to the all physical channels array one to one.

2. Read from configuration file and find the index in the array.

3. Index the physical channels array to pick out the correspondign channel.

 

The problem with this is I have to create a task for every single physical channel it picked, because I can't create the physical channels like when you use multiple selections in the Browse dialog box the way you typically do for a Physical Channel constant.

0 Kudos
Message 2 of 6
(5,227 Views)

You can call DAQmx Create Channel serially for each physical channel connecting your task reference into the 'task in' input so that all will be part of the same task.  Hope this is what you are trying to do.

 

 

Tasks.png

 

 

Randall Pursley
0 Kudos
Message 3 of 6
(5,219 Views)
Solution
Accepted by topic author pellet8

see attached for a simpler attempt

Randall Pursley
0 Kudos
Message 4 of 6
(5,216 Views)

Thank you for the code. That solves the problem.

Can I typecast a string to a DAQmx Physical Channel? This will further simplify my program.


rpursley8 wrote:

see attached for a simpler attempt


 

0 Kudos
Message 5 of 6
(5,213 Views)

You should be able to.  The code does it already at the input to the Create Channel vi

 

Randall Pursley
0 Kudos
Message 6 of 6
(5,209 Views)