Skip to content

FSM Example

Microwave Oven control

A state machine to control a microwave oven.

The oven has a Run push button to start (apply the power) and a Timer that determines the cooking period. Cooking can be interrupted at any time by opening the oven Door. After closing the Door cooking continues. Cooking is terminated when the Timer elapses. When the Door is opened a Lamp inside the oven is switched on; when the Door is closed the Lamp goes off.

The control system has the following inputs:

  • Run push button - when activated starts cooking,
  • Timer - while this runs the cooking is enabled,
  • Door sensor - can be true (door closed) or false (door open).

And the following outputs:

  • Power - can be true (power on) or false (power off),
  • Lamp - can be true (lamp on) or false (lamp off). The knobs to set the power level and timeout values are irrelevant for the control algorithm structure. The behavior of the microwave oven control is determined by the Run push button, Timer and Door sensor.

Solution

There is no one single solution for the control system. Depending on the state machine model employed the system may have different numbers of states. We show three possible solutions for the Microwave Oven control system.

Moore_model_ST_diagram

Figure 1: Moore model

Mealy_model_ST_diagram

Figure 2: Mealy model

9_Mixed_model_ST_diagram

Figure 3: Mixed model (Mealy + Moore)

The details of the state transition diagrams, and especially the actions are included in the state transition tables of the MWOven projects. To display the state transition table, you can either download StateWORKS Studio or take a look at the article Moore or Mealy model?