2. About Swift Act LLC
Introduction to State Machine @ Swift Act LLC
❑ Established @ end of 2017
❑ Legal representation in Egypt and Germany
❑ Experience in Automotive, Industrial Automation, IoT, consumer electronics …
❑ Safety critical experience: IEC 61508, ISO 26262 ...
❑ Process compliance: A-SPICE and CMMI
❑ Mission: Long-term partnership with stakeholders
❑ Vision: Maximizing value for stakeholders
❑ Values: Ethics, Empowerment, Professionalism, Team Work and Trust
❑ www.swift-act.com
3. What is a State Machine?
Introduction to State Machine @ Swift Act LLC
4. Why a State Machine?
Introduction to State Machine @ Swift Act LLC
5. State Machines are Hierarchical
Introduction to State Machine @ Swift Act LLC
6. State Machines are Concurrent
Introduction to State Machine @ Swift Act LLC
8. States are ...
Introduction to State Machine @ Swift Act LLC
States
Finite
Distinct
1 or more
initial states
0 or more
end states
0 or more
intermediate
states
9. State Machine Graphical Representation
Introduction to State Machine @ Swift Act LLC
Stopped Playing
Paused
Play/Song is Playing from beginning
Stop or Song Finished/Song
is Stopped
Pause/Song is Paused
Play/Song is Resumed
Stop/Song is Stopped
10. State Machine Tabular Representation
Introduction to State Machine @ Swift Act LLC
Current State Event Action Next State
Stopped Play
Play song from
beginning
Playing
Stopped Pause Stopped
Stopped Stop Stopped
Stopped Song finished Stopped
Playing Play Playing
Playing Pause Song is paused Paused
Playing Stop Song is stopped Stopped
Playing Song finished Song is stopped Stopped
Paused Play Song is resumed Playing
Paused Pause Paused
Paused Stop Song is stopped Stopped
Paused Song finished Paused
12. State Machine from Design PoV
Introduction to State Machine @ Swift Act LLC
Events Timing events only?
Input events only?
Timing and input events
13. State Machine from Coding PoV
Introduction to State Machine @ Swift Act LLC
Function
for
every
state?
Similar? 1 function + Data
Different? State type + State
variable + function
(switch-case) +
function for every
state (optional)
28. Case Study: Digital Clock
Introduction to State Machine @ Swift Act LLC
Digital ClockSet Button
+ Button
- Button
Hours Units SSD
Minutes Tens SSD
Hours Tens SSD
Minutes Units SSD
29. Case Study: Block Diagram
Introduction to State Machine @ Swift Act LLC
Digital Clock
SW
Time
SSD
Display
32. Case Study: Time
Introduction to State Machine @ Swift Act LLC
Set Hours
Set
Minutes
Normal
Set is pressed
Set is pressed
Set is pressed
33. Case Study: Display
Introduction to State Machine @ Swift Act LLC
Blink
Hours
Blink
Minutes
Blink
Seconds
Time mode = Set Hours
Time mode = Set Minutes
Time mode = Normal