[vox-tech] general algorithm question for an embedded system
Jeffrey J. Nonken
jjn_lugod at nonken.net
Wed Mar 8 10:43:52 PST 2006
On Tue, 07 Mar 2006 18:41:32 -0800
Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
> "finite state machine"
Indeed, I love state machines. I've built entire projects around them.
Had to do some bit-twiddling radio communications (including generating
-- and detecting, of course -- Manchester coding) on a PIC micro once.
Boy, that was fun, let me tell you! Naturally I used a state machine,
as I was generating (and receiving) the bits on-the-fly. And, well, a
bunch of stuff. It was complex, and the most complex part was in the
battery-powered handheld remote, which had the least resources
available. (For speed I stored the next state directly as a pointer
rather than as an index for a case statement.) And naturally, after I
left they designed in a more sophisticated and faster radio system,
which means they took all that carefully designed and tuned code and
tossed it right out the window. *sigh*
State machines are particularly useful where you've got an
interrupt-driven system that needs to remember what it was doing last,
and what it needs to do next, based on current conditions and/or input,
because you're not sitting in a polling loop waiting for the next
event. Or anything where the events happen asynchronously.
Like, debouncing and tracking the mute button.
Oh right, they changed that too. O_o
More information about the vox-tech
mailing list