On Fri, May 22, 2009 at 4:02 PM, Isaac Marino Bavaresco < isaacbavaresco@yahoo.com.br> wrote: > > State machines sometimes get too large and complicated, almost > unmaintainable. With a RTOS (preemptive or non-preemptive) you may > program in a more "normal" manner. > It also simplifies the migration of the code between different > processors and architectures. Unfortunately, the smaller families of PIC > cannot use a preemptive RTOS (or at least not in a useful manner). > I find state machines useful when you're interfacing with the user and you have Menu A with options 1,2,3 which lead to sub-menus B, C, and D for example - it's easy to encode this into a state machine with standard structure. State machines are very fundamental concepts and even if you don't think you're using one you probably are. An "event loop" that checks for the status of inputs and timers is checking the state of the system and reacting accordingly. I have not tried an RTOS on a PIC but I would like to, given a project of necessity. - Martin -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist