From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

String to DAQMX Physical Channel

Solved!
Go to solution

Hi all,

 

I have a DAQMX Physical Channel control connected to a DAQMX Create Channel (digital out).  The channal control give you options for each line, for example, cDAQ1Mod4/port0/line4, but I want an option with a set of lines (without having to type it in).  Is there a way to put a range of line such as cDAQ1Mod4/port0/line0:7 as an option?  I don't want to require the user to have the knowledge to do that.  

 

Also, I don't want to required to user to know what the DAQ number and what the module are before running the test.  For example, cDAQ1 is "tester1" and module4 is "digitial out 12V", and I want to put these option on the UI as check box, and I built the physical channel value in the program to feed into DAQMX Create Channel.  How do I do that?    

 

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 9
(5,071 Views)
Solution
Accepted by topic author jyang72211

Use an enum control on your front panel and write whatever text you want as the descriptions for the channels. On the block diagram use the integer value of the enum to index into an array of DAQmx Physical Channel constants.

 

 

 

diagram.png

panel.png

 

Richard

Message 2 of 9
(5,061 Views)

Also, yes you can specify a range of lines or channels with a colon as you inquired. You can also specify non-consecutive ones by separating the full names by commas.

0 Kudos
Message 3 of 9
(5,060 Views)

Hi Richard, 

 

I was trying to follow your example for the screenshot you provided. 


Could you explain how you created an array for the physical channels and the physical element that came out of index array? 

 

Many Thanks

0 Kudos
Message 4 of 9
(3,881 Views)

If you dig around the DAQmx palette, you will find a channel constant.  That can just be dragged into an array container.  For the indicator, the simplest would be to right click on the index output and create->constant.


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 9
(3,879 Views)

 

Hi Crossrulz, 

 

Yeah I've done that now. 

 

When right clicking on DAQmx Global Channel (channel constant) I right clicked and selected "Change to Array". It didn't change anything when that was selected. When right clicking on the element node of the "Index Array" it does not allow me to select constant. 

 

Have I missed something out? 

Physical Channel Array.PNG

 Many Thanks

 

0 Kudos
Message 6 of 9
(3,876 Views)

 

Hi Crossrulz, 

 

Yeah I've done that now. 

 

When right clicking on DAQmx Global Channel (channel constant) I right clicked and selected "Change to Array". It didn't change anything when that was selected. When right clicking on the element node of the "Index Array" it does not allow me to select constant. 

 

Have I missed something out? 

Physical Channel Array.PNG

 Many Thanks

 

0 Kudos
Message 7 of 9
(3,876 Views)

Sounds like you found a data type the Change To Array does not work with for some reason.  Put down an empty array and drag your channel constant into it.  Once you have that fixed, the Index Array will have a proper output and allow you to make the indicator.


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
Message 8 of 9
(3,872 Views)

Okay I seem to understand it now. 

 

I used Ctrl+Space for the quick drop and selected Array Constant. I then dragged and dropped the DAQmx Global Channel into that and that created the Physical Channel Array I wanted. 

 

Thanks for the advice. 

 

Many Thanks

0 Kudos
Message 9 of 9
(3,870 Views)