Home | Projects | Notes > Embedded Systems Design using UML State Machines > Exercise 2: Productivity Timer (ProTimer)

Exercise 2: Productivity Timer (ProTimer)

 

Overview

The application that tracks your productive working time.

Requirements

  1. + button increments time (minute-level increment).

  2. - button decrements time (minute-level decrement).

  3. Start/Pause button starts or pauses the countdown, or shows STAT if pressed together.

  4. When the countdown is paused, time can be modified.

  5. Press the + and - button simultaneously to abort the running timer.

  6. Application must beep 20 times when it returns to IDLE mode.

  7. When the application is in IDLE mode, pressing the Start/Pause button should show the STAT for 1 sec and auto return to IDLE mode.

Components

States

Events

User ActivityEvent Generated (SIGNAL)ParametersNote
Press + buttonINC_TIMEnoneThis event gets posted to the state machine whenever the user presses the + button.
Press - buttonDEC_TIMEnoneThis event gets posted to the state machine whenever the user presses the - button.
Press S/P buttonSTART_PAUSE This event gets posted to the state machine whenever the user presses the S/P button.
Press + and - button togetherABRT This event gets posted to the state machine whenever the user presses the + and - buttons together.
 TIME_TICKss
(sub second)
This event is system generated for every 100ms.
ss parameter value can vary between 1 to 10.

Extended State Variables

Data Structures

State Machine

Flat State Machine

 

exercise-2-flat-state-machine

 

 

Implementation