You are on page 1of 4

COMSATS University Islamabad

Department of Electrical and Computer Engineering


EEE-342, Microprocessor Systems and Interfacing
Mid Term Examination, Fall 2021Semester
Instructor: Asma Ramay

Section: BEE 5C Dated: 17th Oct 2021


Max. Marks: 25 Max Time: 1 Hour 20Mins
Instructions:
 Attempt all questions.
 Use of Mobile Phones is not allowed

Question 1: (CLO1, C2-PLO1)

a) Program Memory in an MCU is organized as 32k x 16 bits. What is the total size of
this memory in kbytes? _________ ___. (1)

b) What is I/O multiplexing in AVR microcontrollers? (1)


c) How many General Purpose registers are available in ATmega328p? (1)
d) What is branch penalty? (1)
e) What is the use of pre scalar in ADC? (1)
f) ADC of ATmega328P provides result in ________ bits. How is this result stored? (2)
g) Describe the flow of events when an interrupt occurs. (2)

Question 2: (CLO2 , C3-PLO2)

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

Question 3: (CLO3, C4-PLO3)

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)

A temperature sensor is connected with ADC Channel 3 of ATmega328p.

Consider Vref=AVcc=5V.

a) Find out the adc value if Vin=2.1V.

b) Choose a system clock and prescalar if required ADC frequency is 62.5KHz.

c) Configure ADMUX and ADCSRA registers, mention whether you are left
adjusting the result or right adjusting.

Question 5: (4 marks) (CLO2 , C3-PLO2)

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:

You might also like