From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

re-read in values in measurement file when file is updated

Solved!
Go to solution

Hi,

 

I'm trying to control a power supply with labview and set the voltage. I've currently got it working reading in a measurement file and setting it to the value within the file. I'm now having the issue that I would like to update this value when the file is changed, as in read the file again when it is updated and set the new voltage. I've tried several things but if I put the file within the while loop then it reads it once and then returns 0 following the first loop. Outside the while loop it only reads the initial value.

 

I'm quite new to labview so any help would be much appreciated.

 

Thanks,

E

0 Kudos
Message 1 of 7
(2,348 Views)

You might want to explain your application a little better.  Looking for a file to change to set an instrument does not seem like a good idea.  Who is changing the file?  How often is the file changed?

 

A better way might be to use a queue or notifier for setting the instrument.


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 7
(2,334 Views)

The file will be eventually setting many things, but this is just an initial program to get used to the ideas. The power supply is initialised first and then the program literally uses 'Read From Measurement File' which contains a single value of the voltage to set the voltage. The file is changed by a person, and not at a set time interval it's merely so that you can run the program get some data and then change the settings if you wish. There are voltage limits in place so it's quite safe etc.

 

This method has been used alot for this, so it's definitely not an issue. I just was hoping to find out how to update a read in value when the file is changed.

 

Thanks,

E

0 Kudos
Message 3 of 7
(2,330 Views)
Solution
Accepted by topic author eugeniap

You can use the File/Directory Info VI to get the time that the file was last modified.  If the time has changed, read new values.

Message 4 of 7
(2,307 Views)

Hi,

 

Thanks for the help - would it be possible for you to save your VI so I can open it in Labview 2011 please? I'll try and use the File/Director info VI now but would be great to be able to see the example in use.

 

Many thanks, E

0 Kudos
Message 5 of 7
(2,281 Views)

Here is the 2011 version

Message 6 of 7
(2,271 Views)

That's great thanks for the help 🙂

0 Kudos
Message 7 of 7
(2,263 Views)