1
DEPARTMENT OF COMPUTER SCIENCE AND ELECTRONIC
ENGINEERING
ASSIGNMENT COVER SHEET
Module Number CE865
Module Supervisor Amit Kumar Singh
Assignment Number 1
Deadline date and time Midday (11:59), Thursday, 16/11/2017
Assignment Weighting 20%
You should submit your assignment using the Electronic Submission System by the above
deadline.
You must complete your assignment independently. Please refer to the Postgraduate
Students’ Handbook for details of the Departmental policy regarding submission and
University regulations regarding plagiarism.
The assignment mark and feedback sheet will be returned via the Electronic Submission
System no later than three weeks after the assignment submission date.
2
3
CE865 Assignment 1
Autumn Term 2017
1. Objectives
The objectives of this assignment are to demonstrate an understanding of:
1. Programming a microcontroller using the C programming language.
2. The use of the parallel I/O port of a microcontroller.
3. The use of the interrupt system of a microcontroller.
2. ARM Development Boards and Software Libraries
There are a number of laboratory sessions you need to attend before attempting
this assignment. These laboratory sessions help you to use the ARM development
boards and the associated software. Extra time may be needed for some laboratory
sessions. In many cases example source code will be provided for the laboratory
tasks. You should familiarise yourself with them before you start any programming.
You will need to read the ARM Development Board and Software Library manuals
first. These can be found on the CE865 course webpage on Moodle.
3. The Task
The objective of this assignment is to implement a reaction test timer using the
ARM development board.
You are provided with a precompiled program (Reaction Timer) that demonstrates
all of the functionality required to complete this task. Using the Eclipse IDE load
and run this program on the ARM development board before continuing with the
assignment. This program is provided as Reaction Timer.zip in the download section
on moodle. To run, extract it and include the program into workspace. One way to do
is to go to File->OpenProjectsFromFileSystem and browse to Reaction Time
extracted directory. Note that for this project, no compilation is required as it is
already compiled, i.e. sram.elf is available in the bin folder. You just need to download
sram.elf file to the board to see the required functionality.
4
3.1. Operation
The reaction timer displays the time it takes for the user to react to an LED being
illuminated. It displays the time in seconds to an accuracy of one thousandth of a
second.
1. On start-up or after a reaction test has completed, LED 1 should flash to
indicate Button 1 is to be pressed to start the next reaction test.
2. When Button 1 is pressed, the display is zeroed; all the LEDs are turned RED
and begin to count down (turn off) at the rate of one per second.
3. When the last LED turns off a random LED is lit (turned GREEN) indicating the
button that should be pressed to stop the count. At the same time the display
begins counting, showing the elapsed time.
4. When the indicated button is pressed the display stops counting and displays
the time required for the user to react. The timer is ready for the next reaction
test (returns to step 1).
If the user presses any button other than the button indicated by the LED the count
should continue. If the user fails to react, the count stops at 9.999 seconds.
If the user presses one or more buttons before the countdown finishes, the
countdown is suspended until all the buttons are released.
3.2. Method
The reaction timer should use the Programmable Interval Timer (PIT) to ensure an
accurate time period and the SevenSegmentDisplay library to turn the OLED display
into a 4-digit seven-segment display device.
When the reaction period starts the display should begin counting the elapsed time
(see the example Reaction Timer). Programs that do not show the elapsed time count
will receive a lower mark.
You will need to create functions to read the state of the Buttons and set the colour
of the LEDs. Use the template files ButtonFunctions.c and LEDFunctions.c to create
your own library functions (Note that these have to be created by you). If you wish
you could use the provided Button and LED libraries, however a higher mark will be
achieved by implementing your own libraries to perform these functions.
5
You are provided with a program (Assignment 1) containing a skeleton main routine.
Additional local routines and/or variables may also need to be provided to achieve
the required functionally.
3.3. Assessment
You will be assessed on the source code you submit. All code will be recompiled
before testing.
Marks will be awarded as follows:
▪ Well Commented Code (10%)
All the functions should be well commented, describing their purpose and
operation.
▪ Well Structured Code (10%)
All the code produced should be well structured and use appropriate
layout and control statements. Use of ‘cut and paste’ to replicate
statement rather using a more recognised approach will result in a lower
mark.
▪ Display Functionality (40%)
The marks for the Display Functionality are made up as follows:
Use of PIT interrupts (10%)
Display of elapsed time (10%)
Reaction Time count stops at 9.999 (10%) Accuracy
of Reaction Time count (10%)
▪ Button/LED Interface (40%)
The marks for the Display Functionality are made up as follows:
Implementation of Button functions (10%)
Implementation of LED functions (10%)
Flashing LED start indicator (10%)
‘False Start’ detection stops countdown (10%)
6
4. Submission
The deadline for the report is Thursday 16/11/2017 of week 7. You should submit the
any source and header files you have modified or created.
No extensions of the deadlines will be given; if, for any reason, you do not submit
your code there will be no record of the submission time and you will automatically
get a zero mark.
I strongly encourage you to submit your work through the proper channel (electronic
submission) and on time, even if it is incomplete. Some credit is always better than
none.
This assignment is to be done individually, i.e. whatever you hand in must be your own
individual work. Any software or any other materials that you use in this assignment,
whether previously published or not, must be referred to and properly
acknowledged.