0% found this document useful (0 votes)
39 views34 pages

Not Yet Answered Marked Out of 7.00

This document contains 10 multiple choice questions that are part of a midterm exam for a CENG380 course. The questions cover topics related to AVR assembly language programming including addressing modes, instruction encodings, register usage, and I/O operations.

Uploaded by

nancyrazzak5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views34 pages

Not Yet Answered Marked Out of 7.00

This document contains 10 multiple choice questions that are part of a midterm exam for a CENG380 course. The questions cover topics related to AVR assembly language programming including addressing modes, instruction encodings, register usage, and I/O operations.

Uploaded by

nancyrazzak5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

4/21/2021 CENG380 Midterm exam

Question 1
Not yet answered
Marked out of 7.00

Fill all the information to re ect the addresses of the program memory
Adress code
------------- --------------
.org 0x540

0x540 LDI R16, 10

0x541 LDS R10, 0x700

0x543 LDS R11, 0x701

0x545 ADD R16, R10

0x546 STS 0x700, R16

0x548 ADD R16, R11 


0x549 STS 0x701, R16

0x54B here: JMP here

0x542 0x544 0x547 0x54A 0x54C

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 1/34
4/21/2021 CENG380 Midterm exam

Question 2
Not yet answered
Marked out of 9.00

Translate the lines marked by * to Hex


.org 0x00
LDI R16, 10
LDI R23, 5 *
loop: ADD R16, R23
NOP
NOP
DEC R23
BRNE loop *
here: JMP here

LDI R23, 5: 0xE075 


BRNE loop: 0xF7D9

0xF7E1 0xE076 0xF7D1 0xF7E5 0xE066 0xE065

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 2/34
4/21/2021 CENG380 Midterm exam

Question 3
Not yet answered
Marked out of 6.00

In the JMP instruction, how many bits are there for determining the target address?

Select one:
a. 32
b. 8
c. 22
d. 16

Clear my choice

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 3/34
4/21/2021 CENG380 Midterm exam

Question 4
Not yet answered
Marked out of 6.00

Use LDS instead of IN for the following instruction:


IN R20, SPL

Select one:
a. we cannot use LDS instead of IN
b. LDS R20, 0x5D
c. LDS R20, 0x3D
d. LDS R20, SPL

Clear my choice

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 4/34
4/21/2021 CENG380 Midterm exam

Question 5
Not yet answered
Marked out of 7.00

What are the content of R16 and the carry ag after the execution of the following sequence of instructions?
SEC
LDI R16, 0x47
ROR R16
ASR R16

Select one:
a. R16=0xD1 and c=1
b. R16=0xD1 and c=0
c. R16=0x51 and c=0
d. R16=0x51 and c=1

Clear my choice 

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 5/34
4/21/2021 CENG380 Midterm exam

Question 6
Not yet answered
Marked out of 8.00

How many times the loop will be repeated?


LDI R20, 10
now: LDI R21, 20
DEC R21
BRNE now

Select one:
a. 200
b. 10
c. 20
d. in nite number of times

Clear my choice 

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 6/34
4/21/2021 CENG380 Midterm exam

Question 7
Not yet answered
Marked out of 7.00

An AVR has 0x1FFF as the address of its last byte in the RAM and it has 0xFFF as the address of its last location in the ROM.
What are the sizes of the RAM and the ROM?

Select one:
a. Both 4KB
b. RAM 8KB and ROM 16KB
c. Both 8KB
d. RAM: 4KB and ROM: 8KB

Clear my choice

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 7/34
4/21/2021 CENG380 Midterm exam

Question 8
Not yet answered
Marked out of 9.00

Write a program to multiply the contents of the PINB by 10 and store the lower and the higher bytes of the result in the RAM locations
0x500 and 0x501 simultaneously

LDI R16, 10

OUT DDRB, R16

IN R10 , PINB

LDS R16, 10

MUL R10, R16

STS 0x500, 0x00

STS 0x501, 0xFF 


R10 IN R16 0x601 10 LDS 0xFF R0 OUT MUL LDI 0x00 STS R1

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 8/34
4/21/2021 CENG380 Midterm exam

Question 9
Not yet answered
Marked out of 8.00

To make pins1 and 6 of PORTB as output pins and other pins as inputs, you must load register ____________ with ___________.

Select one:
a. PORTB, 0x42
b. PINB, 0x42
c. DDRB, 0xBD
d. DDRB, 0x42

Clear my choice

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 9/34
4/21/2021 CENG380 Midterm exam

Question 10
Not yet answered
Marked out of 9.00

what is the purpose of the following code?


CBI DDRB, 4
SBI DDRB, 7
loop: SBIC PINB, 4
JMP next
SBI PORTB, 7
JMP loop
next: CBI PORTB, 7
JMP loop

Select one:
a. we monitor B4 if its HIGH we set B7 and if it is LOW we clear B7

b. we monitor B4 if its HIGH we clear B7 and if it is LOW we set B7
c. we monitor B7 if its HIGH we clear B4 and if it is LOW we set B4
d. we monitor B7 if its HIGH we set B4 and if it is LOW we clear B4

Clear my choice

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 10/34
4/21/2021 CENG380 Midterm exam

Question 11
Not yet answered
Marked out of 7.00

what is the purpose of the following code?


CBI DDRB, 4
LDI R16, 0xFF
OUT DDRC, R16
again: SBIC PINB, 4
JMP again
OUT PORTC, R16
here: JMP here

Select one:
a. we keep monitoring B4. When it goes HIGH, the program will send 0xFF to PORTC

b. we keep monitoring B4. When it goes LOW, the program will send 0xFF to PORTC

Clear my choice

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 11/34
4/21/2021 CENG380 Midterm exam

Question 12
Not yet answered
Marked out of 7.00

After executing the following code:


LDI R16, 0xFF
OUT DDRC, R16
LDI R16, 0xF4
OUT PORTC, R16
SBI PORTC, 1
CBI PORTC, 5
What is the value of PORTC?

Select one:
a. 0xEC
b. 0xC4
c. 0x57

d. 0x82
e. no-one of the mentioned
f. 0x12
g. 0xA9
h. 0x45
i. 0x90

j. 0xBA
k. 0xD0
l. 0xC2

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 12/34
4/21/2021 CENG380 Midterm exam

m. 0x6D
n. 0xD5
o. 0x65

Clear my choice

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 13/34
4/21/2021 CENG380 Midterm exam

Question 13
Not yet answered
Marked out of 10.00

What is the contents of the stack after executing the instruction marked by * for the second time
.org 0x00
LDI R16, HIGH(RAMEND)
OUT SPH, R16
LDI R16, LOW(RAMEND)
OUT SPL, R16
LDI R17, 0
CALL L1
CALL L2
CALL L3
HERE: JMP HERE
.org 0x100 
L1: INC R17
CALL L2
INC R17
RET
.org 0x200
L2: INC R17 *
CALL L3

INC R17
RET
.org 0x300

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 14/34
4/21/2021 CENG380 Midterm exam

L3: INC R17


RET

Select one:

a.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 15/34
4/21/2021 CENG380 Midterm exam


b.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 16/34
4/21/2021 CENG380 Midterm exam

c.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 17/34
4/21/2021 CENG380 Midterm exam

d.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 18/34
4/21/2021 CENG380 Midterm exam

e. 

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 19/34
4/21/2021 CENG380 Midterm exam

f. 

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 20/34
4/21/2021 CENG380 Midterm exam

g.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 21/34
4/21/2021 CENG380 Midterm exam


h.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 22/34
4/21/2021 CENG380 Midterm exam

i.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 23/34
4/21/2021 CENG380 Midterm exam

j.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 24/34
4/21/2021 CENG380 Midterm exam

k.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 25/34
4/21/2021 CENG380 Midterm exam


l.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 26/34
4/21/2021 CENG380 Midterm exam

m.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 27/34
4/21/2021 CENG380 Midterm exam

n. 

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 28/34
4/21/2021 CENG380 Midterm exam

o.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 29/34
4/21/2021 CENG380 Midterm exam

p. 

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 30/34
4/21/2021 CENG380 Midterm exam

q.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 31/34
4/21/2021 CENG380 Midterm exam

r. 

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 32/34
4/21/2021 CENG380 Midterm exam

s.

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 33/34
4/21/2021 CENG380 Midterm exam

t. 
Clear my choice

https://ols.liu.edu.lb/mod/quiz/attempt.php?attempt=204873&cmid=12035 34/34

You might also like