[vox-tech] general algorithm question for an embedded system
Micah J. Cowan
micah at cowan.name
Tue Mar 7 13:41:51 PST 2006
On Tue, Mar 07, 2006 at 01:37:29PM -0800, Dylan Beaudette wrote:
> this works out ok, for time intervals less than 24 hours, except for one
> thing... the main loop is executed about 6 times per second, therefore the
> test for secs(0) == 00 is evaluated as true 6 times, when i would only like
> it to be evaluated once. Ideally, i need some sort of flag for signalling the
> main if statement to only execute once.
>
> any thoughts on how this could be done with bit or nibble sized variables ?
How about a bit flag named "trigger" that gets set to false whenever
"should execute" is false. When it comes time to execute, check
"trigger": if it's false, execute, and set trigger to true. It won't
execute again until trigger is false again, which won't be until this
execution window has expired.
--
Micah J. Cowan
micah at cowan.name
More information about the vox-tech
mailing list