JayKay Posted October 25, 2011 Report Share Posted October 25, 2011 Dear Friends, I'm involving electronics manufacturing service test department. I have a project to test a DUT for 5 different parameters (all are volatges.I have taken care of signal conditioning and sampling freq ..etc before feeding to DAQ.) I decided to use AI0,AI1,AI2,AI3 and AI4 for data acquisition. All 5 measurements are different minimum and maximum voltage levels. that is.. the expected middle value and tolerance is different for different 5 measurements. I don't want to use the minimum maximum values to be fixed inside my program. a simple text file containig all required middle and tolerances should do the work. so how i can make my program to read the text file consisting the middle and tolrance values for 5 different acquisition? example: lets say at AI0 i'm acquiring an anlalog input. lets say my text file contains AI0 vALUE: 5 v tol: 5% when i execute my prgram , it has to measure AI0 and then verify whether the measurement will fall in between 4.75 and 5.25. if yes the DUT is pass. same way i have to go for AI1,AI2,AI3,AI4. so the question is what program technique i have to use so that my program will read required info from a text file? (i will give access for users to this file. so users will not go inside the program for changing the values in future) Any example program or some hints will be very helpful for me. thanks to all. Quote Link to comment
BrentonLang Posted October 25, 2011 Report Share Posted October 25, 2011 (edited) What I would do is create a config file using the standard XML format. This would be originally created from a TypeDef cluster containing all variables (this is also a good idea because it is expandable if required). LabVIEW contains XML subVis which can be used for this config.xml file. Make sure you specify labels for each element in the TypeDef cluster, as they are required in the XML file. I would start by creating a VI, which won't be used in your main program, to manually write a cluster (as mentioned previously) to a new XML file. Then in the initialization stage of your main program, read the xml file and convert it to usable data by providing the cluster TypeDef as the data type. The good thing about XML files is that it's just text, so it is manually customizable outside of LabVIEW if required. Edited October 25, 2011 by Brenton Lang Quote Link to comment
jcarmody Posted October 25, 2011 Report Share Posted October 25, 2011 I do this using a config file, also. I use the OpenG config file VIs to read the file based on a type-defined cluster and I put it into a Shift Register for access anywhere in the same program. 1 Quote Link to comment
pylb Posted October 25, 2011 Report Share Posted October 25, 2011 You could also create an INI file. LabVIEW API for INI files will sparse the text for you. Quote Link to comment
jcarmody Posted October 25, 2011 Report Share Posted October 25, 2011 You could also create an INI file. [...] In this context, config = INI. Quote Link to comment
Jordan Kuehn Posted October 25, 2011 Report Share Posted October 25, 2011 You could also create an INI file. LabVIEW API for INI files will sparse the text for you. I would recommend this approach as it lends itself to manual editing of the file more than the xml file, a.k.a. the resultant file is far more readable. It can take a few more steps in the actual code, but you only have five channels and it appears as if the file is going to change more frequently than the software Quote Link to comment
JayKay Posted October 26, 2011 Author Report Share Posted October 26, 2011 Thanks everybody friends. Quote Link to comment
crelf Posted November 2, 2011 Report Share Posted November 2, 2011 What I would do is create a config file using the standard XML format. This would be originally created from a TypeDef cluster containing all variables (this is also a good idea because it is expandable if required). LabVIEW contains XML subVis which can be used for this config.xml file. Make sure you specify labels for each element in the TypeDef cluster, as they are required in the XML file. I agree - and if you're working with XML, you need the JKI EasyXML Toolkit. Seriously. Need. It's awesome. Why are you still reading this post? You should be downloading the EasyXML Toolkit demo. Go do it. Now. Quote Link to comment
Ton Plomp Posted November 2, 2011 Report Share Posted November 2, 2011 Another approach is to rely on Max-tasks. You can configure your daq-task with max (with custom scales, calibration and min-max values per channel), and your application will use those settings by referencing to the task. Ton Quote Link to comment
BrentonLang Posted November 3, 2011 Report Share Posted November 3, 2011 (edited) I agree - and if you're working with XML, you need the JKI EasyXML Toolkit. Seriously. Need. It's awesome. Why are you still reading this post? You should be downloading the EasyXML Toolkit demo. Go do it. Now. Hey Crelf, this Toolkit is great! Far more easier than the standard build in XML toolkit. Not 100% sure about the price, but thanks for the heads up anyway. Another approach is to rely on Max-tasks. You can configure your daq-task with max (with custom scales, calibration and min-max values per channel), and your application will use those settings by referencing to the task. Ton Just my personal opinion, I hate creating tasks in MAX. I either have the tasks built in the project explorer or manually create them in code. Sorry, just my opinion. Edited November 3, 2011 by Brenton Lang Quote Link to comment
crelf Posted November 3, 2011 Report Share Posted November 3, 2011 Hey Crelf, this Toolkit is great! Far more easier than the standard build in XML toolkit. Not 100% sure about the price, but thanks for the heads up anyway. Isn't it neat? I was coding something similar up myself once and got annoyed with how long it was taking to write a generic parser - talked to Jim about how EasyXML works, and BAM! It's one of the most over-looked toolkits, IMHO. I either have the tasks built in the project explorer or manually create them in code. Depending on what I'm doing, I prefer to create tasks in my project - then I have something other than a MAX nce file to work with should I need to come back to an old project. It's another feature that a lot of us forget about. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.