LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to modify channels of a DAQmx task programatically?

Hi LVB,

what is the aim behind saving the task/channel to a project file? If you create a task and channel in max you can use it in your application, but if you want to execute your application on an other pc you have to create the tasks and channels again. Why don´t you create your tasks and channels in your application and you don´t need the MAX?

Mike

0 Kudos
Message 11 of 20
(3,661 Views)
> What is the aim behind saving the task/channel to a project file? If you create a task and channel in max you can use it in your application, but if you want to
> execute your application on an other pc you have to create the tasks and channels again. Why don´t you create your tasks and channels in your application
> and you don´t need the MAX?
> Mike

The aim behind saving the task/channel to a project file is allowing distribution of a LabVIEW project to multiple computers.  In a LabVIEW project (.lvproj) file, all NI-DAQmx settings are included.  I am attempting to create some DAQmx utilites to ease development, so I still wish to pursue being able to modify DAQmx channels/tasks/scales dynamically using a LabVIEW project and a running VI.

CLA, CTA
0 Kudos
Message 12 of 20
(3,652 Views)

Hi LVB,

you can export your current MAX settings to an ini file (Max: File -> Export) and add this to your project file. In your application you can load the ini file and read the information you need. To build the tasks you want or to modify existing tasks you can use the DAQmx property nodes and function blocks.

Mike

0 Kudos
Message 13 of 20
(3,648 Views)
Mike,

Thanks for the feedback.  I am still looking to to have a ".vi" that can do the following programatically:

   How to rename/add/delete channels of a task in a LabVIEW project (.lvproj/Project Explorer)?
CLA, CTA
0 Kudos
Message 14 of 20
(3,643 Views)

Hi LVB,

We have a set of VIs that enable you to create and delete tasks, channels, and scales in MAX using the DAQmx storage pallet DAQmx>>Advanced>>System Setup>>Storage, however this is not possible with the channels that you create in a project.

Chris_K

0 Kudos
Message 15 of 20
(3,628 Views)

Hi all,

It seems I am trying to do something similar here.

I have a list of daqmx tasks created in a project.

I want to be able to select 1  or more of the tasks programmatically depending on a config file.

 

The function "Daqmx system > tasks" outputs an array of tasks created in MAX. One or more of these tasks can then be selected.

 

How can I achieve this with tasks created in a project?

 

Any ideas?

cheers

Frank

0 Kudos
Message 16 of 20
(3,322 Views)

Hi Frank,

You can select tasks created in a project by using a task constant found on the DAQmx funtions pallette. Place the task constant on the block diagram and you will be able to click it and select the task of your choice whether it is created in Measurement and Automation Explorer or with a project. Please be sure that the vi you are placeing the task constant in is included in the project. See the attached screen shot for clarification.

 

Regards,
Margaret Barrett
National Instruments
Applications Engineer
Digital Multimeters and LCR Meters
0 Kudos
Message 17 of 20
(3,299 Views)

Margaret,

 

Thanks for the response, but please notice the title of the post.  The question is not how to do this in the development environment, but programatically.

CLA, CTA
0 Kudos
Message 18 of 20
(3,285 Views)

Hi,

I found a simple solution.

I create a number of tasks in the project.

Then have an initialised array of those tasks in the vi.

The config.ini file selects the array index.

 

As long as I remember to add any new task made in the project to the array!

 

cheers

Frank

0 Kudos
Message 19 of 20
(3,266 Views)

You might find the VI's discussed here helpful:

 

Programmatically Call LabVIEW DAQmx Assistants

 

These VI's will let you call the same VI's that MAX uses to edit channels and tasks programmatically!

0 Kudos
Message 20 of 20
(2,905 Views)