Jump to content

program technique - need help.


Recommended Posts

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.

Link to post
Share on other sites

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 by Brenton Lang
Link to post
Share on other sites

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.

post-7534-0-33011400-1319536474.png

  • Like 1
Link to post
Share on other sites

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 ;)

Link to post
Share on other sites
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.

Link to post
Share on other sites

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

Link to post
Share on other sites

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 by Brenton Lang
Link to post
Share on other sites
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.

:thumbup1: 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.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.