LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem writing to config (.ini) file

Solved!
Go to solution

The attached vi works as shown. Why does it not write the data to the file if I remove the 'wait 1 milisecond' code? The section and keys already exist in the file but only get overwritten if I wait a millisecond on every loop iteration. LabVIEW 2015 (15.0.1). I tried changing the config file reference wire to use a shift register.

0 Kudos
Message 1 of 10
(5,986 Views)
Solution
Accepted by topic author Les__Bartel

I removed the wait and it works fine for me.  Do you have something acting in parallel with this code that could be messing something up?


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 2 of 10
(5,970 Views)

No, nothing running in parallel.

0 Kudos
Message 3 of 10
(5,967 Views)

That's an interesting question/observation.  I'm more taken with the fact that you do not use the Refnum Out terminal of the Write (or Read) Key function to an Output Tunnel, and use that to Close Config Data.  Data Flow is a funny thing, and you might have run into an interesting LabVIEW Compiler Optimization that has messed you up.

 

I've taken the liberty of putting both the Refnum and Error Line in shift registers (the Error Line is there for a reason -- use it!) and I removed the Wait.  Does this work the way you expect?  [If it still fails, this should be brought to NI's attention].

Config ReadWrite.png

Bob Schor

Message 4 of 10
(5,965 Views)

Thanks, Bob for your suggestion. I gave it a try and still have the problem. I did think about data flow, and am convinced that what I had should work (at least from the data flow perspective). I know the underlying architecture of the config file VIs uses queues. This suggests that there may be asychronous activity.

0 Kudos
Message 5 of 10
(5,958 Views)

Wow, I hadn't looked "under the hood" before -- that is a little arcane, isn't it?

 

Do you know how to "Ask an Engineer" and get this into NI's Support staff?  This may be worth bringing to their attention ...

 

Bob Schor

0 Kudos
Message 6 of 10
(5,948 Views)

@Bob_Schor wrote:

Wow, I hadn't looked "under the hood" before -- that is a little arcane, isn't it?


Did you not pay attention in my NI Week session.  I flat out stated (or at least intended to) that the configuration files were based on the Single Element Queue setup.  NI could update them to use a DVR instead if they wanted to get some more performance out of the configuration file VIs.


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 7 of 10
(5,934 Views)

I just 'asked an engineer'.

0 Kudos
Message 8 of 10
(5,931 Views)

PEBKAC error. Problem Exists Between Keyboard And Chair. I had another piece of code running in parallel, also writing to the config file. Problem fixed. Case closed.

 

0 Kudos
Message 9 of 10
(5,899 Views)

@Les__Bartel wrote:

I had another piece of code running in parallel, also writing to the config file.


Ah, so my first reply was correct!


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 10 of 10
(5,888 Views)