Beruflich Dokumente
Kultur Dokumente
Assignment 3: 10 marks
Online submission is accepted ONLY. Please answer questions Q1 and Q2, scan, and upload in BB.
For Q3, upload your C-code (main.c) only.
Q1. Fill out the table below with the new value of the registers (R0, R1, R2) after the execution of each
assembly code. Write the results in Hexadecimal. [4 marks]
Note: You may verify the results by running the code in Keil uVision or CCS Simulator
Instruction R0 R1 R2
Q2. What will be the final value of register R0 after executing the following code? You may write the new
value of R0 after every instruction is executed. [3 marks]
Page | 1
CME331: Microprocessor, 2018-19, Term 1
Q3. (Exercise D4.20, p. 183) The circuit diagram shows below interfaces four switches to PD3-PD0 and four
LEDs to PE3-PE0. Switches PD3-PD2 represent a 2-bit unsigned number (i.e., 0, 1, 2, 3). Switches PD1-PD0
represent a second 2-bit unsigned number (i.e., 0, 1, 2, 3). The four LEDs display a 4-bit unsigned number in
binary (i.e., 0 to 15). Write software in C that initializes the ports, reads two 2-bit numbers from the switches,
multiplies them, and displays the result on the LEDs. [3 marks]
Note: You may test your codes using the Launchpad and Digilent ADM as shown in the figure.
Page | 2
CME331: Microprocessor, 2018-19, Term 1
Sample Code:
Page | 3