$30
CSC 230 Assignment 4 Part 2
This assignment has two parts:
1) Written Part: A small written part is available on the Connex site: Tests&Quizzes.
2) Programming Part: Submit it via the Assignments link on the Connex site.
Objectives
Gain confidence with “C” programming.
Create effective subroutines/functions.
Use peripherals: the LCD, timer interrupts and buttons
Academic Integrity
Prior to submitting your assignment, carefully read the University policy on Academic Integrity:
http://web.uvic.ca/calendar2014/FACS/UnIn/UARe/PoAcI.html
Assignment 4: Programming Part [25]
Recall that in Lab 8 and Lab 9 you wrote “C” code to use the LCD display, buttons and timers.
This programming exercise is to combine all of this functionality into one to produce a stop
watch. You can reuse the code from main.c of Lab8, button.c and timer_interrupt.c of Lab9 and
the LCD driver files provided in the lab for this purpose. Your program should do the following:
1. Use a timer to generate interrupts. Choose the timer initial value and scaling factors
appropriately.
2. The Interrupt service routine will maintain four counters, hours, minutes, seconds and
sub-seconds. Sub-second counter is incremented every 1/100 second.
3. These counters are updated appropriately based on the interrupt.
4. Display the time as “hr:min:sec.sub_sec” format on Line 1 of display, two digits for each.
5. Display the same time on Line 2 of the display.
6. When a button is pressed (any button), Line 2 is paused while the time in Line 1
continues to increment.
7. When a button is pressed again (any button), the time displayed in Line 2 resumes and
syncs with the same time as Line1.
8. Note that the display program takes ASCII characters for display. So if you need to
display a number you need to convert that into equivalent ASCII string. For example to
display the number 59, you may not be able to pass the value of 59 directly to the LCD.
Instead it should be converted to two ASCII characters, as 53 (for 5) and 57 (for 9).
9. Submit your “main.c” program and .hex file on conneX
Grading note:
a. If you submit a program that does not compile you will receive 0 for that part of the
assignment.