LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I configure DAQmx tasks or DAQ Assistant using an external text file such as a csv file?

Solved!
Go to solution

I am working in an environment were we have many VI users. I develop the VI's and the technical staff uses the GUI (Front Page) to collect data. In order to control the input parameters used on multiple hardware platforms, I would love to develop one generic VI that will import or read a text file that I have created and configures the DAQmx tasks to perform the DAQ operations. In fact, I have the generic VI completed and need to understand how to make the DAQmx configurations more transparent to the end user as long as the end user has the text file to import. Example being, can the DAQ Assistant generate DAQmx tasks based on text file information?

0 Kudos
Message 1 of 9
(4,324 Views)

Just a thought...

 

We use a system where all input channels are listed in one task that has a specific name.  We then query that task to get the list of channels. We can then show all of the data. The user needs only to configure the channels and the one task in MAX. Would something like this work for you?

 

Or you could just create a text file that has the list of tasks in it and then start the tasks (if you need multiple tasks).

 

     Rob

0 Kudos
Message 2 of 9
(4,313 Views)
i would love to have a text file with a list of tasks in it, but I guess my really problem is, I don't know what format or form the tasks need to be in within the text file for Labview to recognize them when I import or read the file. Any suggestions or examples as two what the text needs to look like for DAQmx to recognize the commands? I don't usually use DAQmx so this is an area of development for me.
0 Kudos
Message 3 of 9
(4,292 Views)

You can go into MAX and export the config file as text and view the format. MAX can also import a correctly formatted config file.

 

It would probably be just as easy to create a text file (tab or comma separated, ini type) that your top level VI would read. Column one might be a job name, column 2 would be the device/channel list, column 3 the sample rate, etc. All of this is easily read and passed to the DAQmx functions. I would design it so that the configuration could be read from a file or created on the front panel saved. You would need to stop using the DAQ Assistant but that's a good thing.Smiley Wink

 

This will get more complex if you are required to have triggering options, analog out, etc. Do you know how flexible it is supposed to be?

0 Kudos
Message 4 of 9
(4,287 Views)

"All of this is easily read and passed to the DAQmx functions."

 

I think I got the text file and format correct from MAX. Thanks for that! Can you please elaborate on the above statement, as I mentioned I'm new to the DAQmx functions? I also think it is great I don't have to use DAQ assistant as it seems rather cumbersome on the base level.

0 Kudos
Message 5 of 9
(4,283 Views)
Okay, lets assume you use something like the Read From Spreadsheet File to get a tab separated file. The results could be displayed in a table. The user would select a row. If column one is the channel list, it might say something like 'Dev1/ai0:2,Dev1/ai5' to acquire channels from channels 0 though 2 and channel 5. This string can be wired directly to the physical channel input of the Create Chanel function. The rate and samples per channel columns can be wired to the rate input of the DAQmx Timing function.
0 Kudos
Message 6 of 9
(4,280 Views)
OK, OK! That's easy enough. Thanks! Now the hardest portion that of the DAQmx configuration, i.e. configuration of the Create Channel Function, is to specify the channel function it's self. Is there a way to specify Voltage or Temperature or Strain using my text file? I guess in DAQmx world there are drop down menus to configure the Create Channel function, but that requires a hard code change if the desired data has changed. I would love to be able to specify the Channel Type using the text file. Some times we use the SCXI 1102 for Temp and other times just for Voltage, but I don't want the end user to make that distinction.
0 Kudos
Message 7 of 9
(4,272 Views)
Solution
Accepted by topic author MTLLockheed

I don't have time to do more than a quick example. The VI below has a table with some fixed index array functions. This would have to modified to automatically get the correct rows and columns but I hope you can get an idea. I did not include any code for setting the type of temperature measurement or to set the correct terminal configuration. All of this plus every other possible option would have to be handled in a similar way to setting the channel type and min/max that is in the example.

 

edit-reattach VI

Message Edited by Dennis Knutson on 11-06-2008 09:59 AM
Message 8 of 9
(4,265 Views)

Thanks for all your help. It's a bit brut force, but it will have to work for now. If you run accross other methods for externally configuring a DAQmx channel, please feel free to post them.

 

Thanks again,

MTL

0 Kudos
Message 9 of 9
(4,239 Views)