AVR Finite State Machine