CSC 2118 Exam Dec2023
CSC 2118 Exam Dec2023
EXAMINATION INSTRUCTIONS
a) ATTEMPT ALL QUESTIONS IN SECTION A (40 MARKS)
b) ATTEMPT THREE (03) QUESTIONS IN SECTION B (60 MARKS)
c) DO NOT OPEN THIS EXAM UNTIL YOU ARE TOLD TO DO SO
d) ATTEMPT EACH QUESTION IN SECTION B ON A NEW PAGE
e) ALL ROUGH WORK SHOULD BE IN YOUR ANSWER BOOKLET
SECTION A
3. Time delays are regularly used in embedded systems to determine when a given
operation starts or stops executing. Using the Atmega 328p and Appendix A, B and C:
a. What bit configuration in which register, is needed to have a clock period of
16 microseconds for Timer Counter1? (4 marks)
b. Calculate the number of counts needed from the counter to make 1 second
with the configuration stated in 3.a. (4 marks)
c. Use Counter 1 and one of its associated compare registers to make a custom
delay function that takes in an integer as a parameter representing number
of seconds. Show your entire code in C/C++ (12 marks)