Abstract

This chapter discusses a simple method for implementing a state machine for an embedded system. A state machine is defined as an algorithm that can be in one of a small number of states. A state is a condition that causes a prescribed relationship of inputs to outputs, and of inputs to next states. The state machine approach should follow a number of steps: learn what the user wants; sketch the state transition diagram; code the skeleton of the state machine, without filling in the details of the transition actions; make sure the transitions work properly; flesh out the transition details; and test. In coding a state machine, try to preserve its greatest strength—namely, the eloquently visible match between the user's requirements and the code. It may be necessary to hide hardware details in another layer of functions to keep the state machine's code looking as much as possible like the state transition table and the state transition diagram.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call