You are on page 1of 7

TEST 1

COURSE : MICROPROCESSOR & INTERFACING

COURSE CODE : BTE3053 / BTE3254

COURSE COORDINATOR : AIRUL SHARIZLI ABDULLAH

DATE : 30 12 2021

DURATION : 1 1/2 HOURS

SESSION/SEMESTER : SESSION 2021/2022 SEMESTER I

INSTRUCTIONS TO CANDIDATES:
1. This examination paper consists of two (2) PART questions. Answer ALL questions.
2. All answers to a new question should start on a new page.
3. All calculations and assumptions must be clearly stated.
4. Candidates are not allowed to bring any materials other than those allowed by the
invigilator into the examination room.

EXAMINATION REQUIREMENTS:

APPENDIX:

NAME : TENGKU MUHAMMAD FIRDAUS BIN RAJA AB.LLAH


NO MATRIX : TG19039

DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO

This examination paper consists of SIX (6) printed pages including the front page.
CONFIDENTIAL 2122I/BTE3053/BTE3254

PART A [25 MARKS]

1. Identify the addressing mode for each instruction in Table 1.


Table 1
Instruction Addressing Modes
ST Z+, R22 Indirect addressing mode
LDI R21, 0x61 Immediate addressing mode
LDS R8, 0x200 Direct addressing mode
LD R18, Z PC-Relative addressing mode

[4 Marks]
[CO1, PO1, C3]

2. If the content of ($200) = 11 22 33 44 55 66 77 88, what are the value of R3 and R4 if


the following programs (i) and (ii) are executed?

LDS R4, 0x202


i. LDI R3, 0x3B
ADD R3, R4
INC R4

R3 = 23D R4 = R4+1

ii. LDS R3, 0x200


LDS R4, 0x204
ANDI R3, 0x1C
ORI R4, 0x17

R3 = 0x10 R4 =0x17

[4 Marks]
[CO1, PO1, C3]

2
CONFIDENTIAL 2122I/BTE3053/BTE3254

3. Determine the values of C-flag, Z-flag and V-flag after execute the following program.

i. LDI R17, 0x3B


LDI R18, 0x0C
ADD R17, R18

C=0 V= 1 Z= .1

ii. LDI R20, 0x7A


LDI R21, 0x4C
ADD R20, R21

C = 1. V= 1 Z= 1

[6 Marks]
[CO1, PO1, C3]

3
CONFIDENTIAL 2122I/BTE3053/BTE3254

4. Given the initial conditions for the memory, evaluate the following program segment
and determine the new content of register and memory affected.

ORG $00 ADDRESS CONTENTS

LDS R5, 0x701 $700 FF


LDI YL, 0x00
$701 22
LDI YH, 0x07
ADD R5, 0x705 $702 65

ST Y, R5 $703 00
ROR R5
$704 AB
INC Y
ST Y, R5 $705 77

R5 =0xA5 ADDRESS CONTENTS

YL = 701 $700 FF

$701 A6
YH= 706
$702 6E

$703 BB

$704 91

$705 77

[11 points]
[CO1, PO1, C4]

4
CONFIDENTIAL 2122I/BTE3053/BTE3254

PART B [25 MARKS]

5. Find the delay in μs of the code snippet below if the crystal frequency is 8 MHz.

DELAY: LDI COUNT, 0x60 0


Again: NOP 1
NOP 1
DEC COUNT 1
BRNE AGAIN 2/1
RET

[6 Marks]
[CO1, PO1, C5]

Solution : Time Delay = [(( 1+ 1+ 1 + 2 ) x 96) +1 + 1] x 0. 125us = 60.25us

5
CONFIDENTIAL 2122I/BTE3053/BTE3254

6. Write a program to test the content of address $70 based on flowchart in Figure 1.

START

R20 ($70)

R20 Yes
>$50

($300) $CC
No

Yes
R20
<$30
($300) $EE
No

($300) $AA

STOP

Figure 1

[19 Marks]
[CO1, PO1, C5]

6
CONFIDENTIAL 2122I/BTE3053/BTE3254

LDS R30, 0x70


CPI R30, 0x50
BRNE STEP 2
STS 0xCC, R20
JMP EXIT
STEP 2 CPI R20 , 0x30
BRLO STEP 3
STS 0xAA, R20
JMP EXIT
STEP 3 STS 0xEE , R20
EXIT JMPE EXIT

END OF QUESTION PAPER

You might also like