Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

16. What is the value of r16 after following instruetion sequence Ldi r16, 200 A

ID: 3750872 • Letter: 1

Question

16. What is the value of r16 after following instruetion sequence Ldi r16, 200 Andi r16, 1 a. 1 b. o c. 200 d. None Answer: 17. The compare instruction spi r16, 0 will update the value of r16 to O a. true b. false 18. The folowing Instruction sequence is an example of loop Label1: cpi r16, 100 Breq Label2 Add r16, r17 Rjmp Lable3 Label2: sub r16, r17 Label3: Idi r16, 1 a. True b. False Answer: 19. The 'lpm' instruction is used to a. load data to data memory b. load data from program memory c. load data to program memory d. load data from data memory Answer: 20. How many times will this loop execute? Ldi r16, 1 cp r16, 10 breq Equal add r16, ri6 Loop: Equal: inc r16 imp loop a. 0 C. d. Infinite Answer:

Explanation / Answer

16)

ldi r16,200

andi r16,1

ldi->ldi means Load Immediate

Loads an 8 bit constant directly to rigister 16 to 31

andi ->Logical And with Immediateand

performs the logical AND between the contents of register r16 and a constant 1 and places the result in the destination register r16.

ldi r16,200 means 200 place in the register r16.

andi r16,1 ->apply AND operation in the content of 200 with 1 get the 200

200 is stored in r16 register.

so answer is c.

17)cpi r16,0

cpi-> compare immediate with accumulator

The 8-bit data is compared with the contents of accumulator .

The values being compared remain unchanged.

so the value r16 to 0 is false.

18)

Label1:cpi r16,100

Breq Label2

add r16,r17

rjmp Label3

Label2:sub r16,r17

Lebel 3: ldi r16,1

Loop is a sequence of instructions based on the condition.

If the condition false looped instructions are not executed.

Until the condition true the instructions are executed.

label is a loop execute the cpi r16,100 and cursor go to the next instruction breq label2.

Than cursor go to the label2 and execute instruction in the label2 and go to the label1.

add r16,r17 and rjmp label3 and go to the label 3 and execute the instructions in the label3.

so given instructions are not the loop.

so the answer is (b) false.

19)The Lpm instruction is used to ->Load data from the program memory.

so the answer is (b)

20)ldi r16,1

Loop: cp r16,10

breq Equal

add r16,r16

Equal: inc r16

rjump Loop

Answer is (d) infinite

Explanation:

ldi r16,1 is executed and go to the Loop and execute the cp r16,10.

Cursor go to the next instruction breq Equal.

Then cursor go to the Equal label and execute the inc r16 and execute the next instruction rjmp Loop.

rjmp Loop mean cursor go to the Loop and start execute.

so given loop is infinite loop..

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote