Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Daq MX Config channels

I wish to programatically define DIO 96 ports for either input or output using LabView Daqmx. It seems a good way is to have a select case function one for Create Virtual channel input, one for create virtul channel output. The 'Lines' input can be used to define a channel, but how can I programatically define the port name (0..11) (channel) that I require for say an input? It seems that the 'Line' input is strange data type, although the 'Create Virtual channel' seems to accept string inputs without an error being generated, but does not seem to respond to them either; what is the format needed for the 'line' input?   
0 Kudos
Message 1 of 6
(4,060 Views)

Hi Steve,

 

Good afternoon and I hope your well today. Thanks for your post. 

 

You are correct. The DIO 96 does not feature line-configurable ports. This means the methd to use is the case structure with DI and DO Create task VI. 

 

The lines input is its own datatype, but it can be coused from a string. The string just needs to be built the same way as the constant from the block diagram. i.e. Dev1/port0. Then consider something like the DAQmx Get Terminal Name with Device Prefix.vi found at \LabVIEW 8.6\examples\DAQmx\_Utility\_Utility.llb\. This vi takes the string and wires it to the DAQmx Line Datatype indicator. Then you can just have the correct datatype. But, it should work with just a string.

 

port.JPG

 

Is this what you meant? Or did you mean can you pass a number to something to 'select' (create) a DAQ task? 

 

 Note: You can write code to detect which slots have what modules by using code such as feature in this community example:

 

Get the DAQmx and Traditional DAQ Device Information

http://decibel.ni.com/content/docs/DOC-2201

 

 

Please get back to me so I can work with you to resolve your problem and make your application successful.

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 2 of 6
(4,042 Views)

Yes this is what I wanted, thanks for that.

 

0 Kudos
Message 3 of 6
(4,035 Views)

Hi Steve,

 

Thanks for the prompt reply and I hope your well today.

 

I am glad that helped. 

 

I have seen a few more posts of yours, and I was wondering how your DAQ / TestStand application was going?

 

Thanks - cheeky to ask for a kudos for that?

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 4 of 6
(4,030 Views)

So far have got the configuring of the 12 DAQ mx ports and writing to them in one vi. I have also managed to pass the tasks as a global variable within the same vi. However I am trying to pass the tasks between different vi's and how discovered that this is not straightforward; something to do with MAX not remembering the tasks and have to add a 'save task' vi.

Can you provide any help on passing the tasks between vi's?

Thanks

0 Kudos
Message 5 of 6
(4,025 Views)

Hi Steve,

 

Good Morning and I hope your well today.

 

You are correct. While a VI is running generally, with the create/run/close structure - the task is unnamed. This is because its just destroyed at the end of the VI. If you wish to pass the reference between multiple VIs or even multiple machine - when thinking about deployment, you need a different approach. The way to save this information about tasks created, configuration settings - including custom scales is to save the channels using the NI-DAQmx VIs. You can clearly do this manually in MAX and export your configuration when deploying, is more commonly used. But in your situation you also need to store this information for other VIs to use. 

 

As the channel is created in MAX, other VIs can then access this and also destory it at a later date. I have found a tutorial on NI Developer Zone with an example library to show how this works more.

 

Programmatic Channel Saves in NI-DAQmx

http://zone.ni.com/devzone/cda/tut/p/id/2873

 

To then use this inline with TestStand would be fine, as MAX information would be avaible to all VIs and you can just run a setup VI to configure the channels based on teststand string input for example.


Please let me know how this finds you, 

 

 

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 6 of 6
(4,009 Views)