I remember being quite pleased when I wrote my first PIC program that actually implemented a state machine. I had a statevariable, and if the statevariable was "1" it did this, "2" it did that, "3" it did the other thing and "4 or more" the statevariable was reset to "1". The rest of the time the software was either polling buttons, running a timre interrupt, or otherwise waiting around doing nothing in particular. Not rocket science, but it sure beat the IF-THEN trees I was writing before that time. I found If-Then trees to be bug-prone, because it is easy to forget to consider all possible cases, and often there are multiple inputs, so you get statements like If (this && if(that || those)){ Do_this(); }else { if(this_other_thing &&That){ Do_some_other thing() etc.e tc. A coffee Cup and a pencil are really exscellent tools for designing a state machine. The coffeecup can be drained into the mouth, lubricating the grey matter, and unless excessive coffee has been consumed allowing the pencil to move faster and more steadlily (or more shakily, if it is a large cup with excessive caffiene) -- Lawrence Lile Wouter van Ooijen Sent by: pic microcontroller discussion list 01/21/2004 04:58 AM Please respond to pic microcontroller discussion list To: PICLIST@MITVMA.MIT.EDU cc: Subject: Re: [OT]: Re: Horowitz... On-the-fly design > What software do you use to create the state diagram? The gray matter inside mys kull. As for tooling: nothing wrong with a mug and a pen (to draw the circles). Seriously: you don't seem to have any idea what a state is, so do some reading. Any basic programming book should contain some hint as to what state/event diagrams are for. Wouter van Ooijen -- ------------------------------------------- Van Ooijen Technische Informatica: www.voti.nl consultancy, development, PICmicro products -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu