microcontroller_test_solutions_full
microcontroller_test_solutions_full
Instructions:
2. For programming tasks, the assembly code solution is provided with explanations.
Answer: c) AVR
Which addressing mode is used to load an immediate value directly into a register?
Answer: b) AND
Which flag in the status register is set when the result of an operation is zero?
Answer: a) Z flag
Answer: b) LSR
What is the primary purpose of the ADC in a microcontroller?
Answer: a) UBRR
Answer: a) 32
Which memory type is typically used for temporary data storage in microcontrollers?
Answer: c) SRAM
Answer: c) STS
Answer: a) 8 bits
Answer: a) No operation
Which of the following instructions is used to rotate the contents of a register left through
the carry?
Answer: b) ROL
Solution:
Solution:
SUB R22, R20 ; Subtract R21 from R20 (R22 = R20 - R21)
Solution:
Solution:
; EVEN Case
BR Exit
ODD:
Exit:
Solution:
Solution:
; Perform a 16-bit addition and store the result in R20 and R21
Solution:
; Compare two registers and set the Zero flag if they are equal
; EQUAL case
BR Exit
NOT_EQUAL:
Exit:
Solution:
Solution:
Solution:
LDI R20, 0xFF ; Load value into R20 for loop count
DELAY: