LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need a way to store ('latch') a measured value in memory

I need a way to store a measured value into a variable when I press a button (using an event structure). This stored value needs to be available like a local variable for the duration of the running of my program. Whenever I click the button, a new measurement is taken and the stored value is updated; but otherwise it is 'latched' between updates.

Dave

0 Kudos
Message 1 of 6
(2,951 Views)

Hi Dave,

 

Take a look at this Nugget on Action Engines.

 

Use a "write" method in the event case and a "read" method everywhere else.

 

Have fun!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 6
(2,945 Views)

Instead of 'latching' a value into a 'local variable', how about storing an array of the values in a shift register?

If the user clicks on the 'Obtain Value' button, a value will be appended onto the already existing array.
If the user does not click in N seconds, a timeout will occur in the event case, and no value will be appended to the array.
Message Edited by Cory K on 03-09-2009 08:57 AM
Cory K
0 Kudos
Message 3 of 6
(2,943 Views)

Thanks. Nice idea. I like the simplicity of this.

I have to say I'm pretty confused about action engines at the moment (are they a 'thing'/VI one uses, or more of concept in programming?) so perhaps will have to come to them another day!

Dave

0 Kudos
Message 4 of 6
(2,916 Views)

oilyfingers wrote:

Thanks. Nice idea. I like the simplicity of this.

I have to say I'm pretty confused about action engines at the moment (are they a 'thing'/VI one uses, or more of concept in programming?) so perhaps will have to come to them another day!

Dave


 

They are something you code then use in your program. Since you code them yourself, they allow almost endless potential to be customized just the way you like. To start your code would just use a read and a write. Latter on you may wnat to add another method like (Compare this value with Latched".

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 6
(2,913 Views)
Cory, one question on this: why the need for a timeout? Dave
0 Kudos
Message 6 of 6
(2,879 Views)