Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

how to save a task name to xml file

I would like to change traditional DAQ Device number + Port number save to configuration XML file to substitude save task name to XML file but so far even the new OpenG XML toolkit does not work. Any suggestions ?
Mario
 
0 Kudos
Message 1 of 10
(4,177 Views)
Hello Mario,

I'm not sure I entirely understand your question. You mention that you want to "change traditional DAQ Device number + Port number save" but then you also mentioned that you want to "substitude save task name" where Task Names are normally associated with the NI-DAQmx driver. Perhaps you could provide some more insight into what you are trying to accomplish?

1. What is your overall goal? As I understand it, you would like to save some of your configuration information to an XML file. Is that correct? What information, specifically, do you want to save to the file?

2. What driver are you using? The detailed device and channel information will change depending on whether you are using Traditional NI-DAQ (Legacy) or NI-DAQmx.

There are couple resources that I think might help you out with this issue. First, there is a tutorial on implementing configuration files for DAQ systems online here. Second, there is another tutorial on programmatically saving NI-DAQmx data here. Finally, this discussion forum discusses different methods for addressing XML data in LabVIEW.

Matt Anderson

Hardware Services Marketing Manager
National Instruments
0 Kudos
Message 2 of 10
(4,157 Views)
Hi Matt
I have some tasks setup in MAX  / DataNeighborhood  / NI_DAQmx Tasks. Say I name it MyVoltageTask. I want to save that name to my XML configuration file and read it back into a DAQmx Task Control on my Front Panel. The older application was using Traditional DAQ which saved Device # and Port # .
When I save to XML I see the following text in the XML file
 
<Name>DAQmx AI task</Name>
<RefKind>Generic Tag</RefKind>
<RefType>NIDAQ</RefType>
<Val>0x04EF4A78</Val>
</Refnum>
 
But, When I try to read it back into the Task Control it is empty.
 
The most simplest example of what I am trying to do is
1) Put a Task Control on the front Panel and set it to a task configured in MAX
2) Save the task to XML
3) Read the XML back to a control.
 
Perhaps I am not seeing a simpler solution to my problem.
 
Mario
 
0 Kudos
Message 3 of 10
(4,151 Views)

Hi Mario,

I have attached example code (LabVIEW 8.5), along with a screenshot of the code, demonstrating writing a DAQmx task name to a file, and then reading the .xml file back in LabVIEW. The reason why you are not seeing anything on the output is because we need to use an ‘unflatten from XML.vi’. If you build the example attached and do not use the unflatten, than you will get the output from your last post. If you would like to see further examples regarding XML, there are some in the LabVIEW Example Finder (Help >> Find Examples >>click on the ‘Search’ tab >> Type in ‘XML’ in the search.

David L.
Systems Engineering
National Instruments
Download All
0 Kudos
Message 4 of 10
(4,126 Views)

Hi David

Thanks for the suggestion. Turns out I had already tried what you suggest without success. I am attaching an llb with a simplified example of my problem. If I only save either of the 2 cluster it works but if I save both it doesnt. In my application I actually have about 8 total clusters that I save to the xml file ( I inherited this ). To try your example I used 1 cluster at a time and both worked but when I combine both then it fails. Each task is obviously name differently. Next I will keep 1 cluster and add 1 element at a time on the 2nd cluster to see where it fails.

 

Mario

 

0 Kudos
Message 5 of 10
(4,109 Views)
Hi David
Actually , during the debugging I found that the example works when run as submitted where the Task is saved and then read back. If one closes LabView then only run the read step then the output is blank. Try it and see if you can confirm and if not what am I doing wrong?
 
Mario
 
0 Kudos
Message 6 of 10
(4,096 Views)

Hi Mario,

I was able to reproduce this issue you found, and have filed CAR # 98750 to R&D for further investigation. Thanks for the feedback!

A workaround is using the ‘Flatten to String.vi’ before  ‘Flatten to XML.vi’ when writing to the file, and then reversing this process when reading. I have attached a VI to write and read using this technique, along with screenshots in case you do not have LabVIEW 8.5.

David L.
Systems Engineering
National Instruments
0 Kudos
Message 7 of 10
(4,080 Views)
Here are the screenshots.
David L.
Systems Engineering
National Instruments
0 Kudos
Message 8 of 10
(4,079 Views)

Hi David

Thanks for the workaround. Always good to get confirmation that a percieved problem is real and caused by my actions.

 

Mario

 

0 Kudos
Message 9 of 10
(4,070 Views)
Hi Mario,

No problem helping you out! We always strive to give our customers the best support possible, and always appreciate feedback. Have a great weekend.
David L.
Systems Engineering
National Instruments
0 Kudos
Message 10 of 10
(4,066 Views)