Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Faculty of Electrical Eng.

Answer all questions in the


UniversitiTeknologi Malaysia space provided Total
SKEE/SEE Marks
Microprocessor Test 1 Date: 18.10.16
3223
Name: Section:

Lecturer: Time: 1 hour

1. Give three features to differentiate between a microprocessor and a microcontroller.


(6 marks)

No Microprocessor Microcontroller 1 mark


A chip that contains all the components of a each
1 A chip that contains only the processor
computer

Need other chips to make a working No need other chips to make a working
2 system system

3 More flexible Less flexibility

Can have very few I/O or many I/O devices


Less component count in system
using the same processor chip

1. A Harvard architecture microcomputer system has 4 Kilowords (1 word is 2 bytes) of


Flash type Code Memory, and 1 Kilobytes of EEPROM both are located at base address
0x0000. There is also 64 Kilobyte Data Memory located at base address 0x0000. The
Data Memory consists of 32 General Purpose Registers which occupy the lowest 32
locations, followed by 64 Special Function Register, and 4 kilobyte Internal RAM. State
the beginning address and the end address of the components by filling in the following
table:
(12 marks)

Beginning address of Flash 0x0000


2 mark
each
End address of Flash $FFF

Beginning address of EEPROM 0x0000

End address of EEPROM $3FF

Beginning address of General Purpose Registers 0x0000

End address of General Purpose Registers 0x001F

Beginning address of Special Function Registers $0020

End address of Special Function Registers $005F

Beginning address of Internal RAM $0060

End address of Internal RAM $105F


2. Given the content of registers as below,
Register Content
R20 $93
R21 $BC
R22 $10
Find the result after executing of the following instructions (show the register and it values
for each of executed instruction). These instructions are executed sequentially.
(8 Marks)

Instruction Results (hex) 1 mark


R20 = D7
SUB R20,R21 1 mark
R22 = CD
ADC R22,R21
1 mark each for
correct value
MULS R20,R21 R1=0A R0=E4 0.5 mark for use
R1 & R0
MULSU R20, R21 R1=E1 R0=E4

1 mark each for correct


value
0.5 mark for use R1 & R0

3. Write AVR Assembly Language codes to do the following:


(10 marks)

Assembly Language 1 mark


Operations
each
R16 <- 10 decimal LDI R16, 10

R17 <- PORT A IN R17, PORTA

R18 <- R16 MOV R18, R16

R18 <- R18 + R17 ADD R18, R17

PORTB <- R18 OUT PORTB, R18

R19 <- (X) LD R19, X

R20 <- (Y),Y + 1 LD R20, Y+

R20 <- R20 – R19 – C SBC R20, R19

Z <- Z – 1, (Z) <- R20 ST -Z, R20

(0x70) <- R19 STS 0X70, R19

2
4. Determine the result for registers and memory addresses by filling in all empty boxes as
provided after the execution of the following instructions. These instructions are
executed sequentially and the initial values of the registers and memory addresses
before instruction execution are given below.
(14 marks)

Register Content Memory


(hex) Address Content (hex)
R23 00 $410 77
R24 18 $411 5E Initial values
R25 AC $412 D7
R26 FE $413 6C
R27 BC $414 7A
R28 14 $415 98
R29 04
R30 11
R31 04

STS 0X410, R23


LD R23, Y
ORI R25, 240
ST -Y, R24
ADD R24, R27
LDD R27, Z+3
NEG R26
ST Z+, R26

Register Content Memory


(hex) Address Content (hex)
R23 7A $410 00
R24 D4 $411 02 Results
R25 FC $412 D7
R26 02 $413 18
R27 7A $414 7A
R28 13 $415 98
R29 04 1 mark each for red
R30 12 answer
R31 04 2 marks for black
answers

You might also like