LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Load value from a file to the configuration of a DAQmx Virtual channel.

Hi Pete!

 

I was wondering if you were able to test these things and how it was working. Please let me know!

 

Best regards,

Collin

0 Kudos
Message 11 of 26
(791 Views)

Sorry for my late reply, Collin. I tried it with the bundle function, and it kinda worked, I mean, it gives no errors, but if I now run my program, it doesn't work like I want it too work. 

So, I will include my VI so you can check it out. So I want to have a notebook file, where I can write the configuration of my strain gages, so I can just load them in the program and use the settings. My problem now is that for the bridge type itself, it doesn't want to read "Full Bridge I" etc from the notebook file. 

In attachment I will add my VI, my subVI's of read and save settings and 2 screenshots of how I want it to be.

I hope you can help me.

 

With kind regards,

 

Peter

 

Ps. Sorry for waiting...

0 Kudos
Message 12 of 26
(732 Views)

I can not add more than 3 attachments, so here is the rest of the attachments i wanted to make. The 2 screenshots of how i want it to be...

 

What am I doing wrong?

 

You can run the program and maybe try it by yourself and see what input and output it gives?

 

With kind regards,

 

Peter

0 Kudos
Message 13 of 26
(726 Views)

Hi Peter,

 

Could you put you whole project in a zip file and upload that please? Also please include the notepad file so I can test your whole project and see what is happening.

 

Thank you and hope to hear from you.

 

Best regards,

Collin

0 Kudos
Message 14 of 26
(691 Views)

Hi Collin!

 

I've added everything into a zipfile. 

I hope you can help me.

 

Many thanks for the answer!

 

With kind regards,

 

Peter

0 Kudos
Message 15 of 26
(663 Views)

Hi Peter,

 

Thank you for sending me all the files. Upon opening the meetapplicatie VIs they are looking for dependancies. Do you have these files located inside a project? (.lvproj file)

 

It would be great if you could send me everything complete.

 

However for the solution you ask for in this forum, I assume you are trying to read the textfile with the read settings gage VI, correct?

 

When trying to read your file I understand why it is not showing the fullbridge as a string. Look good into the bundle function. Here you can see the representation of the data type. There is no enum data type in Save nor Read. Also, Do you want to use Enums or Strings to show and process the Bridge type? I would recommend you to make a type def. For information about type defs and controls etc, please look at this information: http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/custom_cont_ind_type/

 

Also if you place an indicator right after the read from file. You can see that it actually reads everything good as a string. So now the thing we need to adjust is the process of retreiving the information and setting the right data types or them. Also take a look at this information in the community: https://decibel.ni.com/content/docs/DOC-26341 (about enums and strings)

 

Please test these things so you see what it does to your program, after that start adjusting them to your needs. Have a nice day and keep me updated about the progress.

 

Best regards,

Collin de Wit

0 Kudos
Message 16 of 26
(641 Views)

Peter,

     I use the Report Generation Toolkit to read/write Excel files, so I tried generating a little Project to Save and Get Bridge Configuration data from an Excel Workbook.  I've attached the Project (in LabVIEW 2012 -- I think you use 2013, but it should open fine and convert itself).  You'll notice that I use TypeDefs in several places -- the type of Bridge (an Enum) is a TypeDef, the Cluster holding the Configuration is a TypeDef, and the Action (Save or Get Bridge Configuration) is a TypeDef.

 

     The routine that does the work, Manage Bridge Configuration, is an Action Engine, which in this example is a slight "overkill", as there is nothing "saved" between Save and Get (meaning it could have been written as two separate sub-VIs).  However, you could add additional "Actions".  I recall that your original problem had two sets of config data that you needed to save -- you might want to add additional Actions, such as "Open for Saving", "Save Bridge", "Save Something Else", "Close for Saving", and would want to keep the Excel Object "wire" on a shift register between these calls.

 

     There is a Test Bridge Configuration vi that tests this system.  If you look at its Help, you will see what it does and how it uses Manage Bridge Configuration.

 

     Feel free to adapt this to your needs.

 

Bob Schor

0 Kudos
Message 17 of 26
(627 Views)

Thanks for the info, Collin and Bob, I will defenitely try these things and I will keep you up to date.

 

i'm not sure yet if I want to use the Enum or the strings, it's propably easier to use the Enum?

 

And yes, Collin, I want to use the read gage file to read the textfile. I will add the project file in attachment.

 

 

With kind regards,

 

Peter

0 Kudos
Message 18 of 26
(608 Views)

i'm not sure yet if I want to use the Enum or the strings, it's propably easier to use the Enum?


 

I'm assuming you are referring to the Bridge Type in your cluster.  Enums are certainly easier to use programmatically (since you never have to worry about spelling errors, and there is a known number of them, so you can easily create a Case with an Entry for Every Value), but when you write to a (text) file, you want to write the representation of the Enum's value rather than the unsigned integer that LabVIEW uses internally.

 

My code example shows that you can use Format into String and Scan from String to easily do the conversion from "human-readable String" to "internal LabVIEW Enum representation".  It means a little more work when you deal with the Configuration file, but an easier time of it in the LabVIEW code that actually uses the information.

 

Bob Schor

0 Kudos
Message 19 of 26
(601 Views)

There are a lot of argumentsdiscussions about enums vs strings, mostly for state machines.  Strings are easier to extend.  Enums are safer due to spelling and capitalization errors.  Strings can carry parameter data in them.  Enums would need an additional argument (variant or string), usually clustered together.

 

There are pros and cons to either.  Use whichever will be easier for you to understand.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 20 of 26
(594 Views)