Download GTU B.Tech 2020 Winter 5th Sem 2151001 Microcontroller And Interfacing (Ec) Question Paper

Download GTU (Gujarat Technological University Ahmedabad) B.Tech/BE (Bachelor of Technology/ Bachelor of Engineering) 2020 Winter 5th Sem 2151001 Microcontroller And Interfacing (Ec) Previous Question Paper

Seat No.: ________
Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE- SEMESTER?V (NEW) EXAMINATION ? WINTER 2020
Subject Code:2151001 Date:20/01/2021
Subject Name:Microcontroller and Interfacing (EC)
Time:10:30 AM TO 12:30 PM Total Marks: 56
Instructions:
1. Attempt any FOUR questions out of EIGHT questions.

2. Make suitable assumptions wherever necessary.

3. Figures to the right indicate full marks.


MARKS
Q.1 (a) Compare microcontroller and microprocessor. Justify the statement
03
"Microcontroller is single chip solution".

(b) List general purpose registers available to programmers and flags of status
04
register. What is difference between overflow flag and carry flag? In which
situation overflow flag and carry flag will set?

(c) Explain following assembly language instructions with at least one example
07
for each instruction:
(1) LDS (2) STS (3) LDI (4) OUT (5) SBI (6) SBR (7) CLC


Q.2 (a) What will be content of register R16 after executing following instructions?
03
LDI R16, 0xAA
LSL R16
SBR R16,3

(b) Microcontroller product designer decided to interface 8 push-button switches
04
with Port C, 2 digital sensors with PA0 and PA1 pins, 8 LEDs with Port D,
4 Relays with PA2 to PA5, Buzzer with PA6 and PIR sensor with PA7. Write
assembly language instructions to initialize port pins to set direction as per
above hardware requirements.

(c) What is interrupt? What are the external interrupts available in AVR
07
microcontroller? Consider that digital sensor S1 generates external interrupt
0 and digital sensor S2 generates external interrupt 1. Two electrical devices
E1 and E2 are controlled by port pin PB6 and PB7. Write C or assembly
language program such that when external interrupt 0 is generated by sensor
S1, electrical device E1 should turn on by logic 1 at PB6 and electrical device
E2 connected at PB7 should turn OFF by logic 0 at PB7. When external
interrupt is generated by sensor S2, electrical device E1 should turn OFF and
E2 should turn ON.




Q.3 (a) Write C language program to toggle port pin PC6 continuously with highest
03
frequency without using any delay.

(b) What will be status of C,Z,V and H flag after execution of following
04
instructions ..
LDI R16,0xB6
LDI R17,0x4A
ADD R17,R18

(c) Draw interfacing diagram to interface common anode seven-segment display
07
with Port D and 8 push button switches (SW0 to SW7) with Port A of AVR
microcontroller. Consider that this circuit is used in elevator (lift) of 8
storied building to display floor number. When elevator reach to first floor
1

SW1 is pressed and it should display "1". Write assembly or C language
program to display pressed switch number on seven segment display. It
should display "0" if SW0 is pressed, "1" if SW1 is pressed and so on up to
"7" if SW7 is pressed.




Q.4 (a) Write assembly language program to read data from PORT A and PORT B.
03
Perform addition of these data and store answer at memory location 0x0AF9

(b) Push-button switch S is connected to port pin PA7 in such a way that when
04
switch S is pressed, pin PA7 is at logic "0" and when switch S is not pressed
pin PA7 is at logic "1". Buzzer is connected to port pin PC5 with help of
NPN transistor driver circuit. Write assembly language program as per
following requirements.
"When push-button switch S is pressed, buzzer should sound and when
push-button switch S is released, buzzer sound should stop". Use
unconditional loop to run this program continuously to check status of the
switch S and perform above task in infinite loop.

(c) Write C or assembly language program for object counter. Display count
07
value on output device connected with port A (send hexadecimal count value
on port A). Optical sensor is connected to port pin PD2 to sense the object.



Q.5 (a) Write assembly language program to toggle port pin PD7 200 times using
03
conditional branching instruction.

(b) Write assembly language instructions for the following task:
04
Read data from port A and store it in register R16, compare it with 0x7F. If
data in register R16 is greater than 0x7F, set port pin PD0 else clear port
pin PD0. Use unconditional loop to do above task continuously.

(c) Draw and explain interfacing diagram of LCD with AVR Microcontroller.
07
Use Port A to connect data lines, RS with PC0, RW with PC1 and Enable
with PC2. Write Assembly or C language program to display Message
"WELCOME TO GTU" on the first line and "Outcome based Education" on
second line of LCD.



Q.6 (a) Explain any three assembler directives.
03

(b) Which protocol allows to connect 120 devices with AVR microcontroller
04
using only 2 pins of AVR microcontroller? What is name of these 2 pins
which allows multiple device interfacing.

(c) Explain ADCSRA register of AVR microcontroller for ADC programming.
07
Write assembly or C language program to read analog signal using channel
0 (ADC0) of AVR microcontroller. Display equivalent digital data on
PORTC and PORTD.



Q.7 (a) Write any six features of AVR microcontroller.
03

(b) For 10 bit ADC of AVR microcontroller, Vref=2.56V.Calculate D0-D9
04
output if analog input value is 0.25 volt. What will be resolution of ADC?

(c) DC Motor is interfaced to port pins PC0 to PC2 of AVR microcontroller
07
using DC motor driver IC LM293D. PC0 is connected to I1, PC1 is
connected to I2 and PC2 is connected to Enable terminal (E1) of LM293D.
Draw interfacing diagram and write C or assembly language program to
operate DC motor in clockwise direction for 5 seconds, stop for 2 seconds,
anti-clockwise direction for 5 seconds continuously in infinite loop.




Q.8 (a) What will be content of PORTC after executing following C Programming
03
instructions?
2

DDRC=0xFF;
PORTC=0x00;
PORTC=PORTC | (1<<2);
(b) 8 bit DAC is connected to port B of AVR microcontroller. Write assembly
04
or C language program to generate stair-step ramp output from DAC.
(c) Stepper motor is controlled by four port pins PB0 to PB3 in uni-polar mode.
07
Switch S1 is connected to port pin PD2(External interrupt 0) pin. Switch S2
is connected to port pin PD3(External interrupt 1) pin. Write assembly or C
language program to rotate motor clockwise if switch S1 is pressed and anti-
clockwise of switch S2 is pressed in full step mode. Draw interfacing
diagram and write assembly or C language program.

*************
3

This post was last modified on 04 March 2021