Timer

A multi-mode timer, from seconds to weeks.  The software was structured as a state machine with an externally controlled path.  To create the different modes the path through the various states was altered.  Each state had a few flags to control its operation.  Originally this used an Atmel atTiny2313 and was coded in assembler.  It was very tight with only a handful of bytes left over.  When the 4313 came out I wondered if it might be possible to re-code it in C.  Using the GNU tool chain in Atmel studio 6 it came out 1.4 times the size.  You can't beat assembler when you really need to squeeze things in!