LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I implement sample-and-hold in LabView?

This is perhaps a silly question, but I am new to LabView.  I have an analog signal coming in, and I would like to sample it when I press a button on the VI.  I would like the sampled value to be stored so that I can subtract it from the signal coming in.  Basically, I am trying to implement a "tare" feature.  What is the easiest way to do this?
0 Kudos
Message 1 of 5
(6,002 Views)
There are a variety of ways to do this. Can you say a little more about how you want the application to work? It would help us give you the appropriate implementation.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 5
(5,983 Views)
The DAQ is reading an analog voltage signal.  When I push a button, I want to store the voltage value at that instant (let's call that the tare voltage).  Then later downstream, I subtract the tare voltage from the current voltage and display that voltage on a gauge.  I think I know how to do everything except store the voltage value at the push of the button.
 
Thanks for the help!
0 Kudos
Message 3 of 5
(5,949 Views)
Well, one way you could do it is if you have an event driven interface, put the DAQ read in a timeout event with a short timeout. The while loop wrapped around the event structure would have a shift register for holding the "tare" value. The output of the DAQ would drive two controls one for the raw reading and one the raw reading minus the value in the shift register.

A second event would be triggered on a value change of your Tare button. In that event, would be a local variable from the raw data indicator that the event would read to get the value of the indicator (which would be the last DAQ read) and write it to the shift register. Alternately, you could have a second shift register that always holds the last raw value read from the DAQ. In the Tare button value change event you would copy the data from that shift register to the one holding the tare value.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 5
(5,944 Views)
this alogorithm is what i develop to toggle tare on and off.
hope this helps,
0 Kudos
Message 5 of 5
(5,883 Views)