1.Keep track of time. 2.When the time matches a stored value an
alarm should go off. 3.Functionality that allows for the user to
set the time to a desired value. 4.Functionality that allows for
the user to set the alarm to a desired value. 5.Allow for the alarm
function to be enabled or disabled. 6.Incorporate a snooze feature
7.Display the time and the alarm time. Functions of an Alarm
Clock
Slide 3
Implementation 1.Hours, Minutes, Seconds variables introduced
by Phil. Needed to add in some code to have the hours operate in
the 12-hr system and to keep track of am and pm. 2.A simple test to
see if the time and the stored alarm time are the same. 3/4. Use
one on board button to switch between 3 modes: Running, Settime,
and Setalarm. To be able to set the time or the alarm I used
another 3 on board buttons; one to toggle between the hours and the
minutes being selected, and the other two to increase or decrease
the selected variable. 5. To ensure this function is not changed by
accident, it requires two of the on board buttons to be pressed and
released simultaneously. 6. An additional large button that when
pressed disables the alarm for five minutes (from when the snooze
button was pressed, not when the alarm first went off). 7. An LCD
display allows for more information to be displayed in an easy to
understand format. I have included the time (or alarm time), a
decimal point to indicate the state of the alarm, another decimal
point to show pm, and a letter to indicate what mode you are
in.
Slide 4
Layout
Slide 5
Code Start and Running Loop Set up input/output ports Declare
and initialize all variables Running loop if change mode pressed
goto Set Time loop if enable/disable alarm pressed switch the state
of that variable if alarm is enabled goto tests for the alarm Goto
Running
Slide 6
Set Time Loop if up button pressed increase current variable
(either Hours or Minutes) if down button pressed decrease current
variable (either Hours or Minutes) if Hr/Min button pressed toggle
between the variables Hours and Minutes if enable/disable button
pressed toggle enabled/disabled if mode button pressed goto Set
Alarm loop Goto Set Time loop
Slide 7
Set Alarm Loop if up button pressed increase current variable
(either AHR or AMI) if down button pressed decrease current
variable (either AHR or AMI) if Hr/Min button pressed toggle
between the variables AHR and AMI if enable/disable button pressed
toggle enabled/disabled if mode button pressed goto Running loop
Goto Set Alarm loop
Slide 8
Tests for Alarm Test AM/PM if AM/PM matches for alarm and time
goto test hours Return Test hours if Hours and AHR are the same
goto test minutes Return Test minutes if Minutes and AMI are the
same goto test seconds Return Test seconds if Seconds is 0 goto
Alarming Loop! Return
Slide 9
Alarming Loop! Alarming Loop if Snooze button has been pressed
increase alarming variable by 5 minutes and goto Tests for Alarm if
Snooze button hasnt been pressed BEEP! if off button pressed turn
alarm off and go back to Running if enable/disable button pressed
turn alarm off, disable alarm function, and go back to Running
GotoAlarming Loop