MP Mid Term
MP Mid Term
MP Mid Term
a) Program Memory in an MCU is organized as 32k x 16 bits. What is the total size of
this memory in kbytes? _________ ___. (1)
a) Which pins of PORTC are configured as output and input after complete
execution of the following code. (2)
DDRC = your roll number;
DDRC = DDRC | (1 << 3);
b) The code below sends two different values on PORTD continuously with some
delay. Correct the errors (logical and syntax) in given code: (2)
INCLUDE "M328PDEF.INC“ DELAY:
LDI R5, 0X00 LDI R20, 200
OUT DDRD, R16 LOOP1:
MAIN: LDI R21, 250
LDI R16,0x300 LOOP2:
OUT PIND,R16 NOP
CALL DELAY DEC R21
LDI R16, 258 BRNE LOOP2
OUT PIND,R16 DEC R20
RJMP MAIN BRNE LOOP2
Make a subroutine in assembly to generate a delay equal to your roll number x 100
microseconds. Show your calculations. (4)
Question 4: (5 marks) (CLO3, C4-PLO3)
Consider Vref=AVcc=5V.
c) Configure ADMUX and ADCSRA registers, mention whether you are left
adjusting the result or right adjusting.
The external interrupt 1 (INT1) of Atmega328p is configured using the following code.
The Interrupt Service Routine (ISR) increments a global variable (counter) by 4 each
time it executes. What will be the value of ‘counter’ if a finite signal shown in Figure.1 is
applied to INT1 pin of the MCU? Explain how.
Registers:
ADMUX
ADCSRA: