程序代写代做 C clock Introduction

Introduction
ECE 3375 – Final Assessment K. McIsaac & J. McLeod
This final assessment takes the form of a set of questions to be solved with reference to the documentation for a specific microcontroller. Both microcontrollers and questions have been randomized. The assessment has been designed so each student will do work of equal difficulty.
Aids permitted
This assessment is OPEN BOOK. We have provided microcontroller manuals in which the answers to all factual questions can be found, however other sources, including class notes and internet-based sources, can be used. For each question, students MUST specify the source of the information used in the solution. Example sources might be:
• User Manual – Section 4.2.1
• Manufacturer Application Note AN 145
• Manufacturer support forum Dated MM/DD/YY, URL
However, it is the firm expectation that students will submit THEIR OWN UNIQUE WORK. Collaboration between students on this assessment is NOT PERMITTED and will be treated as an academic offense. The instructors may request in person follow-up interviews, either randomly or based on suspicion of collaboration. In the event of such a follow-up interview, the interview will form part of the assessed grade.
Submission Format
Your work must be submitted to OWL by 5:00pm on Saturday, April 18. Answers can take the form of scanned written material, or text prepared in a word processor such as MS-Word. Please convert to PDF before uploading. Note that a smartphone can be used to scan directly to PDF with the appropriate app.
Assigned material: You will work with the one microcontroller, as specified below. Some microcontrollers exist in “families”, in which the user manual describes the general performance of the family, whereas a specific datasheet describes details (register addresses, usually). Where necessary, both documents have been provided.
Assigned microcontroller: ADUC84X Assigned manuals: ADUC84X – Complete.pdf

Q1. Memory maps (10 marks)
a. What is the range of the address space? (2 mark)
b. Where is the code memory located? (1 mark)
c. Provide decode logic for the main RAM block. (4 marks)
d. How can software be installed into the non-volatile code storage? Is special hardware
required? Can the device “re-program itself” in software? (3 marks)
Q2. General Purpose I/O (12 marks)
a. List at least three (3) ports that CAN be used for digital I/O. For each port, provide the following information (6 marks):
i. Is the port always digital I/O or can it be configured for a special purpose? (1 mark per port)
ii. Does the port support bidirectional operation? If so, how is it controlled? (1 mark per port)
b. Write a simple C program with the following features. Make sure your program makes register addressing clear (3 marks):
i. Two port bits assigned as digital inputs X and Y. (You can use any valid input bits.) ii. One port bit assigned as digital output Z. (You can use any valid output bit.)
iii. Digital output Z performs the logical AND operation Z = X AND Y
c. Write a C function to test a single bit of a specified port. You can choose how the port is specified by the user, but your answer must make this choice clear. The function should have the following signature (3 marks):
Q3: Timing Peripherals (8 marks)
a. How many timers does the unit have that can be used for setting up a regular timed event (ie: one event each 0.001 seconds, each 0.01 seconds, etc). (1 mark)
b. Choose one timer and answer the following questions: i. Can the timer be stopped and started? (1 mark)
ii. Can the timer be cleared? (1 mark)
iii. Can the timer be set to a value other than zero? (1 mark)
iv. What are the addresses of register(s) used to control the timer? (1 mark)
c. Write the software required to cause a repeated timer event at 1ms (0.001s) intervals. If necessary, assume the system clock frequency is 10MHz. You can use EITHER a polled OR interrupt-based approach. (3 marks)
i. If you choose a polled approach, include the polling loop and status bit check.

ii. If you choose an interrupt driven approach, include the code to enable the interrupt and identify the appropriate interrupt vector.
Q4: A/D Peripherals (8 marks)
a. What type of A/D conversion is used? (1 mark)
b. How many channels can the A/D unit measure (1 mark)
c. How many bits of resolution can the A/D unit measure (1 mark)
d. If necessary, assume there is an external reference voltage of 5.0V. What would the
A/D converter return if the external voltage was 4.5V? (2 marks)
e. Write the software necessary to repeatedly read one analog channel. Make sure your
answer includes A/D initialization and shows how you will wait for the completion of the read. It is not necessary to convert the sampled value to volts. (3 marks)
Q5: Communications (8 marks)
a. How many UARTs does the unit have? (1 mark)
b. What is the maximum bit rate (baud rate) of which the UART is capable (1 mark).
c. Does the unit have other communications protocols built-in? If so, list them. (2 marks)
d. Write the software necessary to configure the port for 9600 bits per second, No parity,
8 data, 1 stop. (2 marks)
e. Write a routine to receive a single byte over the UART. The function should have the
following signature (2 marks)
Q6: Interrupts (6 marks)
a. Where is the interrupt vector table located (ie: what range of addresses?) (1 mark)
b. How is the current context stored after an interrupt? How is the context restored after
the ISR is complete? (2 marks)
c. Write the code necessary to trigger an interrupt after a byte is received via UART.
Ensure that your answer makes clear how global interrupts are enabled, and how the specific interrupt is enabled (3 marks)