Assembly Language Functions, embaded system, EECE 237

profileh2o
eece_237_s15_-_hwk_3.pdf

EECE 237 Spring 2015 Homework Assignment #3 – Interrupts, Precise Timing in C Assignment: Starting with the template file (on the BbLearn page), create a program that turns our board into a precise timer. The project will measure how close (in milliseconds) a user can come to hitting the button at the same time the top (12 o’clock position) LED is turned on, and display the results on the LCD screen. The program will display “EECE 237 Hwk 3 “ on the top line, and your name on the second line at startup, and wait for a button press. Once the button is pressed, the program begins to count down, displaying a “-- Ready --” message on the top line, and the number of seconds remaining (7..0) in the middle of the second line, updating every second. At the same time, the LEDs are turned on, one per second, moving in a clockwise direction. When the count reaches zero, the message will change to “-- GO --“, and the top (12 o’clock)LED will be lit. The user will attempt to press the button at exactly that time. If the button is pressed within 1 second (before or after) of the time the top LED is lit, the time difference between the button press and the LED ON event will be displayed (Early: ### or Late: ###, where ### is the number of milliseconds). The next button press will place the board back in the “-- Ready --” state and restart the countdown process.

• The time measurement should be based on SysTickInterrupts. • All delays should be based on this Timer (No count delay loops) • The button press must be interrupt based (not polled) • If no button press occurs within one second AFTER the top LED being lit, a “Timeout” message

should be displayed, and the next button press will place the board back in the “-- Ready --” state and restart the countdown process

• If a button press occurs more than one second BEFORE the top LED being lit, the board will return to the “-- Ready --” state and restart the countdown process

Deliverables: 1) Source code for solution program: C source file - submitted via BbLearn page. (Do not submit other project

files). The file MUST be named as follows: <first initial>_<last name>_hw3.c for example, mine would be d_word_hw3.c

The source code file must contain your name and student ID in the header block at the top of the page, and should be commented enough to be easy to read

Due Date: Friday, May 1st – Assignment must be submitted to BbLearn by 8pm.

Display -- Ready -- 7, 6,...2,1

Counting down and moving LED display clockwise

(once/second)

Power on...

“ -- Go -- “ Display, Top LED lit

1 Second later...

Early/Late time difference displayed

(in milliseconds)

Early : 124 msec

Button Press

More than 1 second early?

No

“Timeout” Display

Button Press

EECE 237 S15 Lab #3 <your name>

Button Press

More than 1 second late?

No

Yes

Button Press