Chapter 10: Finite State Machines

Embedded Systems - Shape The World
Jonathan Valvano and Ramesh Yerraballi

As part of the edX online class, we made some interactive web pages to illustrate fundamental concepts


Interactive web pages: Table of Contents

2. Fundamental Concepts Number conversions
5. Introduction to C Flowcharts, C vs assembly
6. Microcontroller Ports Input/output, direction register
7. Design and Development Successive refinement, if-then, loops
10. Finite State Machines Vending machine and stepper motor
11. UART Serial Interface Blind, busy-wait, interrupt, serial port
12. Interrupts Mail box, context switch
13. DAC and Sound Sampling rate, precision, how a DAC works
14. ADC and Data Acquisition    How an ADC works, Nyquist Theorem

 

Interactive Tool 10.1

A simulation of a Vending machine dispensing soda with the corresponding FSM state changes



Interactive Tool 10.2

Click 'CW' or 'CCW' to step the motor clockwise and counterclockwise, respectively. Observe how different microcontroller outputs to the motor coils produce different responses from the motor. Assume that an output value of '1' to a motor coil will cause current to flow in that motor, resulting in a 'N' oriented magnetic field at that coil.




Questions:
What is the output sequence that produces one complete counterclockwise rotation in the motor?
What is the output sequence that results in one complete clockwise rotation in the motor?
Identify two sets of output values in the sequence that will never occur one after the other.
How can you implement a stepper motor with a finite state machine? Draw the complete state graph with all transition arrows.

 

Reprinted with approval from Embedded Systems: Introduction to ARM Cortex-M Microcontrollers, 2016, ISBN: 978-1477508992, http://users.ece.utexas.edu/~valvano/arm/outline1.htm

and from Embedded Systems: Real-Time Interfacing to Arm® Cortex™-M Microcontrollers, 2016, ISBN: 978-1463590154, http://users.ece.utexas.edu/~valvano/arm/outline.htm

Creative Commons License
Embedded Systems - Shape the World by Jonathan Valvano and Ramesh Yerraballi is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
Based on a work at http://users.ece.utexas.edu/~valvano/arm/outline1.htm.