LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DaqMX Channel Constants as something like a Menu Ring

Hi All,

 

I have a pinout on my DAQ board to control all my hardware. I would like it that if I change the pinout I don't have to trawl through my entire program changing references to Dev/a0 to Dev/a1 etc. Is there anyway of have a menu ring type constant whereby I can type define this thing and if I click "Device 1" then it will output whichever port I have specified in the congiruation?

 

Regards,

 

Craig

0 Kudos
Message 1 of 13
(4,325 Views)
You can define the task in MAX or in your project. The channels could be defined there. The DAQmx Create Channel function can use a front panel control simply by right clicking on the input and selecting Create Control. There should only be one place at the beginning of the program where you define the channels. From that, you should be passing the task so I don't see where you would be trawling through the program. You aren't using multiple DAQ Assistants are you? If so, drop the training wheels and use DAQmx functions directly. There are numerous examples to help you get started.
0 Kudos
Message 2 of 13
(4,314 Views)

http://imgur.com/j4k9kEc

 

Here is an example: on the left I define 3 sepperate channels ao0, ao1,ao2. To call their DAQmx channel parameters, I need the Visa resource name (on the right in the while loop). I wouldlike to have a type defined, enumerated style constant so I can just drop it down and choose for instance Scan Mirror (Y) and it then inputs for me the correct visa resource name. 

 

I could just use a sub vi which subs in from a an enum, but that's not very clean I dont think.

 

Any advice welcome,

 

Craig

Download All
0 Kudos
Message 3 of 13
(4,288 Views)
0 Kudos
Message 4 of 13
(4,287 Views)
You do realize that you can name tasks and choose that way.

It's also silly to talk about VISA since its not used at all for DAQmx.
0 Kudos
Message 5 of 13
(4,274 Views)

If you name your tasks appropriately you can use a Combo Box input for specific names. This has a string datatype, but when wired to your DAQmx task or channel input, it will coerce to the DAQmx type and find the task (or use the channel) with that name.

 

Ideally, you let the user pick from specific tasks or channels that the system recognizes instead of the above option. If you were to change a task name or hardware in the future, you would have to make sure to go back and update your combo boxes.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 6 of 13
(4,269 Views)

http://digital.ni.com/public.nsf/allkb/46CC27C828DB4205862570920062C125

Unfortunately strings don't type define properly, this solution would have been perfect though. 

0 Kudos
Message 7 of 13
(4,255 Views)
Do you need to type define it? It should only be found in one location on your user interface and should be handled as just a string passed around your application after the user has selected something.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 8 of 13
(4,246 Views)

If I want to add ports later and only update one control.

0 Kudos
Message 9 of 13
(4,223 Views)
That's what I'm saying, you only need the one control. Your front panel control. Pass that string value, or array of strings, to initialize your task(s) and you don't need the combo box selection anywhere else.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 10 of 13
(4,199 Views)