41081 Chapter 3: Sensing Actuation and Control
Chapter 3 – State Machines
Time-Ordered Behaviour
• Where outputs depend on the order in which input events occur.
• C uses a sequential instructions computation model, where statements are executed
seuetiall util the list’s ed is eahed. This appoah is good for capturing
algorithms that transform input data into output data (aka. Data processing
behaviour). However it is not good for capturing time ordered behaviour, as code
tends to become less understandable as more time-oriented behaviour is
introduced.
• State machines are one such computational model which is better for capturing time
ordered behaviour.
State Machines
• State machines are a computation model designed to capture time-ordered
behaviour.
• A drawing of a state machine is called a state diagram.
• At a tie, the sste is i a state, alled the current state.
• If oe of the uet state’s tasitios has a tue oditio fo a gie tik, a
implicit transition back to the state itself is taken.
o A tick, is the process where a transition leaving the current state and having a
true condition is taken, and then the transitions target state has its actions
executed once, and then becomes the new current state.
o Many ticks occur per second.
• For a state machine to be precisely defined, transitions leaving a particular state
should have mutually exclusive transition conditions.
o Only one condition can be true at any time. If two conditions are true, the
machine becomes non-deterministic.
• A transition between states without a condition will always evaluate as true, and
thus will always transition.
• Using state machine models allows the time-ordered programs to be more clearly
expressed than a C program.
• The following pattern detects a rising edge of a signal, but can detect a falling edge
with the condition swapped.
find more resources at oneclass.com
find more resources at oneclass.com
Document Summary
Time-ordered behaviour: where outputs depend on the order in which input events occur, c uses a sequential instructions computation model, where statements are executed se(cid:395)ue(cid:374)tiall(cid:455) u(cid:374)til the list"s e(cid:374)d is (cid:396)ea(cid:272)hed. This app(cid:396)oa(cid:272)h is good for capturing algorithms that transform input data into output data (aka. However it is not good for capturing time ordered behaviour, as code tends to become less understandable as more time-oriented behaviour is introduced: state machines are one such computational model which is better for capturing time ordered behaviour. State machines: state machines are a computation model designed to capture time-ordered behaviour, a drawing of a state machine is called a state diagram, at a(cid:374)(cid:455) ti(cid:373)e, the s(cid:455)ste(cid:373) is (cid:862)i(cid:374)(cid:863) a state, (cid:272)alled the current state. Ribs: ribs (riverside irvine builder of state machines) is a tool supporting graphical state diagram capturing of sms, the sms initial state is set by ticking the initial state box.