0% found this document useful (0 votes)
14 views

MODULE 4 Embedded Systems FSM

The document discusses finite state machines as a modeling technique to represent systems by defining their possible states, the behavior in each state, and how the system transitions between states based on defined inputs or events. It provides examples of how physical systems like phases of water and an air conditioner can be modeled as finite state machines. The key aspects of a system that can be modeled with a finite state machine are defined as a finite set of states, a finite set of inputs that trigger state transitions, behavior depends on current state and input, and each state defines behavior for all possible inputs.

Uploaded by

Samuel Agyawu
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

MODULE 4 Embedded Systems FSM

The document discusses finite state machines as a modeling technique to represent systems by defining their possible states, the behavior in each state, and how the system transitions between states based on defined inputs or events. It provides examples of how physical systems like phases of water and an air conditioner can be modeled as finite state machines. The key aspects of a system that can be modeled with a finite state machine are defined as a finite set of states, a finite set of inputs that trigger state transitions, behavior depends on current state and input, and each state defines behavior for all possible inputs.

Uploaded by

Samuel Agyawu
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Finite State Machines

Finite State Machines


OVERVIEW:

There are many ways of modeling the behavior of


systems[reasons for modeling a system:(design a similar system or to write a
program for it, to upgrade its functionalities, to create a counter system… if the

system under study poses a problem) ] and the use of state machines
is one of the oldest and best known. State machines allow
us to think about the “state” of a system at a particular
point in time and characterize the behavior of the system
based on that state.
The use of this modeling technique is not limited to the
development of software systems.
In fact, the idea of state-based behavior can be traced
back to the earliest considerations of physical matter. For
example, H2O can exist in 3 different states easily
observable in nature:
• [State 1 ] solid (ice)
(application of heat)
• [State 2 ] liquid (water)
(application of heat)
• [State 3 ] gaseous (steam, fog, clouds).
• (application of heat)
• ???? [State 3 ] gaseous (steam)
• (application of freeze)
• [State 3 ] gaseous ( fog, clouds).
• (application of freeze)
• [State 2 ] liquid (water)
• (application of freeze)
• [State 1 ] solid (ice)
• (application of freeze)
• ????[State 1 ] solid (ice)

Note that in each of these states, the behavior of H2O is different.


The means of forcing transitions between the 3
states is also well defined. Many other natural and
artificial systems may also be modeled by defining
(1) the possible states the system can occupy,

(2) the behavior in each of those states,

(3) how the system transitions between the states


ie. From its current state to the next state,

(4) which states are “connected” and which are not.


• A = [B,C,]
• B = [A,D]
• C = [A,E,D]
• D = [B.C]
• E = [C]
States of the air conditioner
• A activation of the cooler (cooling)
• C activation of the heater (heating)
• B Activation of the fan (neutral)
Transitional temperature values:
1. Room temp < 16 deg…….(heating must start)
2. Room temp= 25 deg…..(no heating or cooling)
3. Room temp >25deg…..(cooling must start)
4. CONNECTED STATES: B=A
B=C
We can use a similar technique to model and
design systems by identifying what states the
system can be in, what inputs or events trigger
state transitions, and how the system will behave
in each state.
In the following model, we will view the execution
of the software as a sequence of transitions that
move the system through its various states.
State Machines

Consider a turnstile entry control system. (diagram)


a rotating gate with a coin receiver. The gate is initially
‘locked” and will not rotate to allow a passenger to pass
through. When a coin or token is deposited into the
receiver, the gate is “unlocked” but does not turn until the
person actually pushes on it and passes through the
turnstile, at which time the gate locks until the next coin is
deposited.
From this description, it should be clear that the turnstile
is always in exactly 1 of 2 possible states: Locked or
Unlocked. There are also only 2 transition triggers:
depositing a Coin and Passing through the gate. We can
model the system graphically, using rounded rectangles to
represent states and arrows to represent transitions
between states, as shown in Figure 1 below.
While this is a good approximation of how the
system functions, we can see that certain
information about the turnstile's behavior is not
clearly defined. What happens when another coin
is deposited before someone passes through the
gate? Similarly, what happens if a person tries to
pass through the gate without depositing a coin?
In both cases, our simple model should remain in its
current state. We show this behavior with “loop”
transitions in Figure 2. We also add an indication of
the initial state of the system using a solid circle and
an arrow pointing to the start state.
Conceptual Definition of a Finite State Machine
From the discussion so far, we can identify several key
characteristics of a system that can be modeled with a finite
state machine:
1. The system must be describable by a finite set of states.
2. The system must have a finite set of inputs and/or events
that can trigger transitions between states.
3. The behavior of the system at a given point in time depends
upon the current state and the input or event that occur at
that time.
4. For each current state of the system, behavior is defined for
each possible input or event.
5. The system has a particular initial state.
How To Design A Finite State Machine
ELEVATOR scenario
• Possible state: ground floor or first floor
Possible inputs: up, down
Outpus of the led’s: on, off
Current state input Next state red light green light

0 1 1 1 0

0 0 0 1 0

1 0 0 0 1

1 1 1 0 1

You might also like