Professional Documents
Culture Documents
MTQP Emb Sys 2015 16
MTQP Emb Sys 2015 16
INSTRUCTIONS:
Q1. (b) Mention whether the following statements are TRUE or FALSE. (1 X 5)
(i) The AVR microcontrollers use von-Neumann architecture.
(ii) The .DB directive can be used to store character strings in the flash memory.
(iii) All general purpose registers of the ATmega microcontroller are 8-bit wide.
(iv) The LDI instruction can be used to store a constant into any of the GPRs.
(v) The IN instruction is used to bring the content of any memory location to a GPR.
Q2. Consider the following program segments and determine the content of all the affected
registers/Input-output ports/memory location after each line/group of lines in a loop is
executed. Also mention if any relevant flag is affected. Assume that the stack pointer is
initialized to the highest RAM address in the data memory space. (2 X 5)
1
Q3. Analyze the following program segments and explain what functions they achieve (5X2)
(a) (b)
.ORG 0x0100; LDI R20, 0xEB;
LDI R25, 0x20; LDI R21, 10;
CALL FUNC; CALL SUBR;
| STS 0x300, R20;
.ORG 0x0200; MOV R20, R22;
FUNC : PUSH R26; CALL SUBR;
BACK1: LDI R26, 0x00; STS 0X301, R20;
BACK2: DEC R26; STS 0x302, R22;
BRNE BACK2; |
DEC R25; SUBR: LDI R22, 0;
BRNE BACK1; L1: INC R22;
POP R26; SUB R20, R21;
RET; BRCC L1;
DEC R22;
ADD R20, R21;
RET;
Q4. (a) Explain what are the various addressing modes of the AVR Instruction Set. Illustrate
your answer with examples. State any limitations of this instruction set. (5)
(b) Write an Assembly Language Program to search the range of data memory locations
from 0x100 to 0x1FF and count how many of them are positive, how many are negative and
how many are zeros. Store the counts in the memory locations 0x200 (positive), 0x201
(zeros) and 0x202 (negative) respectively. (10)
Q5. (a) Explain how the use of an interrupt mechanism can help free up processors time.
Illustrate your answer with an example in the context of the ATmega32 microcontroller. (5)
(b) Write an Interrupt Service Routine (ISR), which along with the standard tasks that any
ISR must carry out, monitors the 8 lines connected to the input port PORTB. It checks how
many of these lines is high (1) and if the number exceeds 4, then sets an alarm that is
connected to bit 7 of PORTC configured as an output port. Also write a small segment of the
MAIN program which will initialize the stack pointer and ports appropriately. (10)
2
3