06-06-2014 02:26 PM
Hello,
I've been looking through and through to find a simple way to capture a single instance of an analog input signal and store it as a constant. To be specific I want to take the very first value an analog signal outputs upon running the program and store it as a constant to be used elsewhere.
Thank you for any help the forum community might be able to provide.
Solved! Go to Solution.
06-06-2014 02:35 PM
There isn't nearly enough information in your post to even begin giving an intelligent answer. More information? Do you have any code written yet?
Mike...
06-06-2014 02:48 PM
Well the eventual code shouldn't be anything extensive ( First Analog Input ----> constant), so no I don't have any code to provide.
I've run through ideas like:
1. Capture the first input by looking for a rising edge. But then how do you prevent the next rising edge from overwriting your variable?
2. Using a logic based approach. Such as combining a counter with the analog input that when and only when the counter is 1 do you capture the analog input. but then how do you combine boolean logic with an floating point value.
06-07-2014 09:06 AM
Hi Doug,
Look at this article about functional global variables. You can use this pattern to set the value once, then read it globally within your application.