0% found this document useful (0 votes)
130 views1 page

Task 6.2: Finite-State Machine Model: Setminutesclock Sethoursclock

This document describes a finite-state machine model for a digital clock and alarm system. The system has states for setting the hours and minutes of the clock, setting the hours and minutes of the alarm, and an alarm state. Transitions between states are triggered by buttons on a rotary dial and joystick to increment, decrement, and select the time and alarm values. When the alarm time is reached and the alarm is enabled, it will trigger the alarm state.

Uploaded by

Miguel Martínez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views1 page

Task 6.2: Finite-State Machine Model: Setminutesclock Sethoursclock

This document describes a finite-state machine model for a digital clock and alarm system. The system has states for setting the hours and minutes of the clock, setting the hours and minutes of the alarm, and an alarm state. Transitions between states are triggered by buttons on a rotary dial and joystick to increment, decrement, and select the time and alarm values. When the alarm time is reached and the alarm is enabled, it will trigger the alarm state.

Uploaded by

Miguel Martínez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Task 6.

2: Finite-State Machine Model


[Rotary button]
if CW: hours++ [Rotary button]
if CCW: hours-- if CW: minutes++
if CCW: minutes--

setHoursClock [Joystick button setMinutesClock


pressed]
entry/ clock Init (); Change minutes of clock.
Change hours of clock Exit/ set time();
Power-up

[Joystick button
pressed]
[Joystick button pressed]
[Rotary button
pressed] Toggle
Alarm Switch();
setMinutesAlarm [Joystick button setHoursAlarm [Joystick button RTClock
pressed] pressed]
Change minutes of alarm. Change hours of alarm. displayTime();
Exit/set alarmExpire,
alarmSwitch(ENABLE);
[Every 1 second]: second
counter increases & green
[Rotary button] LED toggles
[Rotary button]
if CW: alarm minutes++ if CW: alarm hours++ [(time=5s || Any button is
if CCW: alarm minutes-- if CCW: alarm hours-- pressed)] : Turn off red LED [Current Time = Alarm &&
Alarm is enabled]

Alarm State
entry / led_toggle(RED) @ 4 Hz,

You might also like