0% found this document useful (0 votes)
6 views27 pages

EC Microcontroller and Interfacing

The document outlines the examination structure for the Microcontroller and Interfacing (EC) subject at Gujarat Technological University, detailing the exam dates, total marks, and instructions for students. It includes a series of questions covering topics such as microcontroller specifications, assembly language programming, interfacing concepts, and various protocols. The examination format consists of multiple questions with specific marks allocated to each part.

Uploaded by

pmforuse
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views27 pages

EC Microcontroller and Interfacing

The document outlines the examination structure for the Microcontroller and Interfacing (EC) subject at Gujarat Technological University, detailing the exam dates, total marks, and instructions for students. It includes a series of questions covering topics such as microcontroller specifications, assembly language programming, interfacing concepts, and various protocols. The examination format consists of multiple questions with specific marks allocated to each part.

Uploaded by

pmforuse
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Enrolment No.

/Seat No_______________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V EXAMINATION – SUMMER 2025
Subject Code:2151001 Date:09-05-2025
Subject Name:Microcontroller and Interfacing (EC)
Time:02:30 PM TO 05:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

Q.1 (a) Give difference between Microcontroller and Microprocessor. 03


(b) List selection criteria for Microcontroller for any embedded product. 04
(c) Draw and explain the AVR data memory structure. 07
Q.2 (a) Explain Macros with suitable example for AVR Microcontroller. 03
(b) List difference between JUMP and CALL instructions. 04
(c) Write an assembly language program to calculate multiplication of two 16 bit 07
numbers stored in memory location 2000H to 2003H.
OR
(c) List and explain addressing modes of AVR with one example. 07
Q.3 (a) Explain any three bit oriented instructions for AVR microcontroller. 03
(b) Assume that R19 has packed BCD. Write a program to convert the packed BCD 04
to two ASCII numbers and places them in R20 and R21.
(c) Write an assembly language program to copy block of 20 bytes of data from 07
data memory locations starting at $130 to RAM locations starting at $60.
OR
Q.3 (a) Explain memory allocations in C program for AVR Microcontroller. 03
(b) Write an AVR C program to convert FD hex to decimal and display the digits 04
on PORTB, PORTC, and PORTD.
(c) Write an assembly language program to add block of 10 bytes of data from data 07
memory locations starting at $150.
Q.4 (a) Explain difference between interrupts and pulling. 03
(b) Draw control word for TIFR register for Timer 1 in AVR microcontroller. 04
(c) Write a program to generate delay of 25.6 ms. Use Timer 0, CTC mode, XTAL 07
=8 MHz, and prescaler = 1024.
OR
Q.4 (a) Draw the interfacing diagram of keyboard with AVR microcontroller and explain 03
its working.
(b) Draw and explain ADC interfacing with AVR microcontroller. 04
(c) Write a program for AVR to transfer the letter “G” serially at 9600 baud, 07
continuously. Use 8-bit data and 1 stop bit. Assume XTAL= 8 MHz.
Q.5 (a) Explain the criterion need to be considered in choosing the relay. 03
(b) Explain interfacing of RTC with AVR microcontroller. 04
(c) Explain stepper motor interfacing with AVR microcontroller. Also write 07
program to rotate it continuously.

1
OR
Q.5 (a) Explain I2C bus protocol. 03
(b) Draw and explain DC motor connection using Darlington transistor with AVR 04
microcontroller.
(c) Draw and explain LCD interfacing with AVR microcontroller. Also write 07
program to display “ Happy New Year” on LCD.

******************

2
Enrolment No./Seat No_______________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE- SEMESTER–V (NEW) EXAMINATION – WINTER 2024
Subject Code:2151001 Date:20-11-2024
Subject Name:Microcontroller and Interfacing (EC)
Time:10:30 AM TO 01:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

MARKS

Q.1 (a) What is the size of code and data memory in ATmega32 03
Microcontroller
(b) Explain the criteria for selecting a microcontroller. 04
(c) Explain various addressing modes of AVR microcontroller with 07
appropriate example

Q.2 (a) What is the difference between Microprocessor and Microcontroller 03


(b) Draw and explain the Data memory for the AVR with Extended I/O 04
memory
(c) Draw and explain the Harvard architecture in the AVR. 07
OR
(c) Explain following instructions with appropriate example. 07
1. SBRS
2. LDS
3. SWAP
4. MULS

Q.3 (a) What is MACRO and how it is used? 03


(b) Explain the following instruction with example 04
1. RET 2. RCALL
(c) Discuss SPI bus protocol with reference to AVR microcontroller 07
OR
Q.3 (a) What are assembler directives? Explain any three assembler 03
directives.
(b) Draw and explain the status register of AVR Microcontroller 04
(c) Draw block diagram of 8bit timer/counter and explain its operation. 07

Q.4 (a) Write an AVR C program to toggle all the bits of Port C 50 times. 03
(b) Explain steps in executing interrupt in AVR ATmega32 04
microcontroller.
(c) For AVR ATmega32 microcontroller, assume that INT0 pin is 07
connected to a switch that is normally high. Write a C program that
toggles PORTC.3, whenever INT0 pin goes low. Use external
interrupt in level triggered mode. Explain your program with
necessary comments.
OR

1
Q.4 (a) How to enable and disable interrupt in AVR ATmega32 03
microcontroller.
(b) Which are the different timers are available in ATmega32. Explain 04
the times 1 with necessary diagram.
(c) Write an AVR ‘C’ program using Timer0 and Timer1 interrupt, 07
generate square wave on PB1 and PB7 respectively while
transferring data from port C to port D.

Q.5 (a) How does SPI bus protocol work? 03


(b) Draw the interfacing diagram of keyboard with AVR microcontroller 04
and explain its working.
(c) Discuss temperature sensor interfacing with ATmega32 and write a 07
program to display temperature on PORT B.
OR
Q.5 (a) Explain functioning of DDRX, PORTX, and PINX registers with 03
appropriate example.
(b) Which are the different features of ADC in AVR? 04
(c) With diagram explain LCD interfacing with ATmega32 07
microcontroller.

*************

2
Enrolment No./Seat No_____________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – SUMMER 2024
Subject Code:2151001 Date:14-05-2024
Subject Name:Microcontroller and Interfacing (EC)
Time:02:30 PM TO 05:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

MARKS
Q.1 (a) List various AVR family microcontroller with their specifications. 03
(b) Explain the simplified view of an AVR microcontroller with necessary 04
diagrams.

(c) Explain the hardware architecture of ATMega32 microcontroller. 07

Q.2 (a) Explain the following assembler directives, 03


(i) .EQU
(ii) .ORG
(iii).INCLUDE
(b) Describe the relation between the registers and pins of AVR 04
microcontroller.
(c) Write an assembly language program to generate square wave of 50% 07
duty cycle on bit ‘0’ of port ‘C’ and 60% duty cycle on bits’3’ of port
‘C’.
OR
(c) Write short notes on register and direct addressing mode with an example 07
and necessary diagrams.

Q.3 (a) Explain the status register of AVR microcontroller. 03


(b) What is MACRO and how is it used? 04
(c) Classify the instruction sets of AVR microcontroller and explain it with 07
an example.
OR
Q.3 (a) Compare arithmetic shift with logical shift operation of AVR 03
microcontroller.
(b) Describe the features of RISC processor. 04
(c) Write an assembly language program to transfer the value 41H serially 07
(one bit at a time) via pin PB1. Put active high bit at the start and end of
data bits. Send the LSB first.

Q.4 (a) Compare branch and CALL instructions of AVR controller. 03


(b) Explain interfacing concept of stepper motor with necessary diagrams. 04
(c) Explain the interfacing of stepper motor via an opto-isolator with 07
necessary diagrams and write a ‘C’ language program to monitor the
switch connected with PA7. If the SW=0, the stepper motors move
1
clockwise else anticlockwise.
OR
Q.4 (a) Explain the feature of ADC available in AVR. Assume 10 bit ADC and 03
Vref =2.56 volt. Calculate D0-D9 bits output if the analog input is 0.2V.
(b) Write a ‘C’ language program to read a temperature sensor and display 04
on port D.
(c) Write a ‘C’ language program to read the keyboard and send the result to 07
port D. Assume PCO-PC3 connected to columns and PC4-PC7 connected
to rows.

Q.5 (a) Explain the use of PWM signal in AVR controller with an example. 03
(b) Explain SPI protocol of AVR microcontroller. 04
(c) Explain asynchronous serial communication and write a ‘C’ language 07
program to transfer letter ‘A’ serially at 9600 baud rates continuously.
Use 8-bit data, and 1-stop bit. Assume XTAL= 8 MHz
OR
Q.5 (a) Define the interrupts and types of interrupts available in the AVR 03
controller. What is the priority of it.
(b) Write a ‘C’ language program that gradually changes the speed of a DC 04
motor from 50% to 100%.
(c) Write short notes on I2C protocol with necessary diagrams. 07

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – WINTER 2023
Subject Code:2151001 Date:02-12-2023
Subject Name:Microcontroller and Interfacing (EC)
Time:10:30 AM TO 01:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.
MARKS

Q.1 (a) Compare IN instruction with LDS instruction. 03


(b) Describe the flag register of AVR microcontroller. 04
(c) Write short notes on AVR data memory. 07

Q.2 (a) Explain any three assembler directives of AVR. 03


(b) Compare RISC and CISC architecture. 04
(c) Explain the following instruction with an examples 07
(i) BRSH (ii) CBI (iii) SBIS (iv) NEG (v) ASR
(vi) SWAP (vii) LDI
OR
(c) Write an assembly language program using look-up table method to get 07
value of x from Port B and send x2 to Port C. Assume that PB3-PB0 has x
value of 0-9.

Q.3 (a) Write an assembly language code to transfer value $30 on the location $105 03
and on the PORT B IO register.
(b) Describe JMP, RJMP, IJMP and Conditional JMP instructions of AVR. 04
(c) Write a ‘C’ program to read the keypad and send the result to Port D 07
PC0-PC3 connected to column
PC4-PC7 connected to rows
OR
Q.3 (a) Write an assembly language code to determine if RAM location 0x200 03
contains the value 0. If so, put 0x55 into it.
(b) Describe CALL, RET, RCALL and ICALL instruction of AVR. 04
(c) Explain the dual role of Port A, B, C and D of AVR also explain the role of 07
DDR register to inputting and outputting of data with an example.

Q.4 (a) Write a ‘C’ program to convert packed BCD 0x34 to ASCII and display the 03
bytes on PORT B and PORT C.
(b) Explain Timer/Counter Control and Interrupt flag register of AVR. 04
(c) Write a ‘C’ program to toggle only the PORTB.4 bit continuously every 70 07
uS. Use Timer 0, normal mode, and 1:8 pre-scaler to create the delay.
Assume XTAL = 8 MHz
OR
Q.4 (a) Write a ‘C’ program to convert ASCII digit of ‘7’ and ‘2’ to packed BCD 03
and display them on PORT B.
(b) Explain MCU Control Register and Status Register of AVR with necessary 04
diagram.
(c) Write a ‘C’ program using Timer 1 of AVR which toggles pin PORTB.5 07
every second, while at the same time transferring data from PORT C to
PORT D. Assume XTAL = 8 MHz.
1
Q.5 (a) With Vref = 1.28 V, find the Vin for following outputs 03
(a) D7-D0 = 11111111 (b) D7-D0 = 10011001
(c) D7-D0 = 01101100
(b) Assuming XTAL = 8MHz, using non-inverted mode, write an assembly or 04
‘C’ program that generate a wave with frequency of 31,250 Hz and duty
cycle of 75 %.
(c) Discuss I2C BUS protocol with necessary diagram 07
OR
Q.5 (a) Calculate the step size for following ADC if Vref is 5 V 03
(a) 8-bit (b) 10-bit (c) 12-bit (d) 16-bit
(b) Write a ‘C’ program that gradually changes the speed of DC motor from 04
50% to 100%
(c) Discuss SPI BUS protocol and its various modes with necessary diagram. 07

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE – SEMESTER- V EXAMINATION-SUMMER 2023
Subject Code: 2151001 Date: 22/06/2023
Subject Name: Microcontroller and Interfacing (EC)
Time: 02:30 PM TO 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed

Marks
Q.1 (a) Differentiate Microprocessor and Microcontroller 03
(b) List down the number of ports available in ATmega32. 04
Mention the steps to configure them as input and output ports.

(c) Draw the internal block diagram of Atmega32 microcontroller. 07

Q.2 (a) List down the features of Atmega32 Microcontroller 03


(b) What are pseudo codes? Explain any three in detail with 04
examples.
(c) Classify instruction set of AVR microcontroller. Explain them 07
in detail with examples.
OR
(c) Explain with examples rotate and shift instructions of 07
Atmega32 Microcontroller.

Q.3 (a) Differentiate RISC and CISC instruction set. 03


(b) Write a loop to generate delay of 100ms with XTAL frequency 04
as 8MHz.
(c) Draw TIMSK register and explain each bit. Show the 07
instructions to enable the timer0 overflow interrupt and timer2
compare match interrupt.
OR
Q.3 (a) Define interrupt. List down steps to be taken before execution 03
of an interrupt.
(b) Using timer, generate delay of 1 second with XTAL frequency 04
as 8MHz.
(c) Explain TIFR register and also write the steps to program 07
timer2 in normal mode.

1
Q.4 (a) Write down the various data types with range used in 03
embedded C programming.
(b) Explain simplex, half and full duplex transfers of data 04
communication
(c) Interface 8 LEDs and a switch with AVR controller and write 07
a program to demonstrate up/down counter with mod control.
OR
Q.4 (a) Discuss how branch instructions are executed. 03
(b) Explain CALL and RET instructions. 04
(c) Write a C language program to monitor PB0 continuously an 07
soon as it goes high activate the buzzer connected on PB1 and
send a high to low pulse on PB2

Q.5 (a) Explain with diagram, working of relay. 03


(b) Write down hex codes to display 0 to 9 on common cathode 04
seven segment LED.
(c) Draw and explain various control registers of UART 07
communication in ATmega32.
OR
Q.5 (a) Explain the concept of opto-isolator. 03
(b) Write a note on I2C BUS protocol. 04
(c) Write a program to display “Microcontroller” on LCD 07
interfaced with ATmega32.

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – WINTER 2022
Subject Code:2151001 Date:21-01-2023
Subject Name:Microcontroller and Interfacing (EC)
Time:10:30 AM TO 01:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

Q.1 (a) Explain AVR status register in detail. 03


(b) Identify which register of AVR ATmega32 is responsible to perform 04
following function.
1. To decide prescaler value for timer
2. To identify status of conditional flag to be used to perform conditional
branch.
3. To store result of Analog to Digital conversion.
4. To control status of input/output ports.
(c) Explain Conditional and Unconditional Branch Instructions. Show with 07
example how to calculate the short branch address?

Q.2 (a) Write Features of RISC Architecture. 03


(b) What is Branch Penalty in AVR Explain with Example. 04
(c) Write a program to count up from 00H to FFH and send the count to PORT 07
B. Use one CALL Subroutine for sending the data to PORT B and another
one for time delay. Put time delay of 1s between each issuing of data to
PORTB. Assume that the crystal frequency is 8 MHz and the system is using
an ATmega32.
OR
(c) Assume that the data memory location 0x315 has value FD(hex).Write a 07
program to convert it to Decimal. Save the digits in locations 0x322, 0x323
and 0x324, where the least significant digit in location 0x322.
Q.3 (a) Explain the Format of Intel Hex File. 03
(b) A door sensor is connected to the PORT B pin 1 and an LED is Connected to 04
PORT C pin [Link] an AVR C program to monitor the door sensor and, when
it opens, turn on the LED.

1
(c) Write an assembly language program to generate time delay of 10ms using 07
timer 1 in normal mode. Choose prescaler of 1024. Exclude the instruction
overhead due to the instructions in loop. Assume XTAL = 8MHz
OR
Q.3 (a) Assume XTAL=8 MHz.(a) Find the Clock Period fed to Timer0 if a prescaler 03
option of 1024 is chosen.(b) show what is the largest time delay we can get
using this prescaler.
(b) How the Timer0 can work as an Event counter? Explain in Brief. 04
(c) Write a program (in Assembly or C) that toggles pin PORTB.7 every 90 μs, 07
while at the same time transferring data from PORTC to PORTD. Assume
XTAL = 1MHz and use Timer0 with Interrupt.
Q.4 (a) Assume that the INT0 pin is connected to Switch. Write an assembly 03
language program in which, whenever it goes low the content of PORTC
increases by one.
(b) With diagram explain baud rate generation mechanism for serial 04
communication in AVR microcontroller.
(c) Write an assembly language program to transmit the message “GTU” 07
serially at 9600 baud, 8-bit data and 1 stop bit. Do this Forever.
OR
Q.4 (a) Explain what happens if both INT1F and INT2F are activated at the same 03
time?
(b) How does SPI bus protocol work? 04
(c) Discuss temperature sensor interfacing with ATmega32 and write a 07
program(in Assembly or C) to display temperature on PORT D.
Q.5 (a) Explain the controlling stepper motor via optoisolator. 03
(b) Indicate the step to identify the key pressed. 04
(c) Two strings are given in memory. String s1 = “Hello”, String s2 = “World”. 07
Write an assembly language program to display string s1 on 1st row of LCD
and string s2 on 2nd row of LCD.
OR
Q.5 (a) Write ATmega32 ADC Features. 03
(b) Assuming that clock pulses are fed into pin ICP1, write a program to read the 04
TCNT1 value on every rising edge. Place the result on PORTA and PORTB.
(c) Explain the connection of Stepper motor with AVR. And write a program to 07
rotate it continuously.
*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V(NEW) EXAMINATION – SUMMER 2022
Subject Code:2151001 Date:20/06/2022
Subject Name:Microcontroller and Interfacing (EC)
Time:02:30 PM TO 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

MARKS
Q.1 (a) What is an assembler directive? Explain .org, .set directives. 03
(b) Draw & Explain AVR status register. 04
(c) Draw & Explain Harvard architecture in the AVR 07

Q.2 (a) What is the difference between microcontroller and 03


Microprocessor?
(b) Explain SWAP and ADIW instructions with example. 04
(c) Write an assembly program that finds number of 1’s in a given 07
byte.
OR
(c) Write an assembly program to get the x value from PORTB and 07
send x2+2x+3 to PORTC. Assume PB3-PB0 has the x value of 0-
9. Use a look up table instead of a multiply instruction.

Q.3 (a) Explain TCCR0 register in timer. 03


(b) Explain LPM and CPSE instructions with example. 04
(c) Write a C language program to toggle only the PORTB.4 bit 07
continuously every 70 us. Use Timer0, Normal Mode, and 1:8
prescaler to create the delay. Assume XTAL = 8MHz.
OR
Q.3 (a) What is the difference between Interrupt and polling? 03
(b) Write different steps in executing interrupt. 04
(c) Assume that the INT0 pin is connected to PORTD.2 which 07
normally remains high. Write an assembly language program that
toggles PORTC.3 whenever INTO pin goes low.

Q.4 (a) Draw and explain interfacing diagram of 4x4 keypad with AVR. 03
(b) Draw interfacing diagram of LCD with AVR. 04
(c) Write a program that (a) after 4 external clocks turns on an LED 07
connected to the OC0 pin, (b) toggles the OC0 pin every 4 pulses
OR
Q.4 (a) Explain following command code in LCD. 01, 08 and C0. 03
(b) Write different steps to transfer data serially in AVR. 04
(c) Write a program to transmit the message “YES” serially at 9600 07
baud, 8 bit data and 1 stop bit. Do this forever.

Q.5 (a) Describe the different features of ADC in AVR. 03


(b) Write down steps in programming the A/D converter using 04
polling.

1
(c) A switch is connected to pin PA7. Write an assembly language 07
program to monitor the status of switch and perform the following
:
a. If Switch =0, the stepper motor moves clockwise
b. If Switch =1, the stepper motor moves counter clockwise
OR
Q.5 (a) Explain DS1307 control register. 03
(b) Explain multibyte read and write operation in SPI. 04
(c) Show how a master writes the value 11110000 to a slave with the 07
address 1001101 in I2C bus.

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – WINTER 2021
Subject Code:2151001 Date:14/12/2021
Subject Name:Microcontroller and Interfacing (EC)
Time:02:30 PM TO 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

MARKS
Q.1 (a) List various AVR family microcontrollers with basic specification. 03
(b) Explain following AVR instructions : 04
a) JMP b) ORI

(c) Draw and explain ATMEGA32 pin configuration. 07

Q.2 (a) Give the name and the manufacturer of some of the widely used 8 bit 03
microcontrollers.
(b) Explain AVR assembler directives. 04
(c) Explain AVR MACROs in brief. 07
OR
(c) Explain how the I2C read and write operation works? 07
Q.3 (a) List all major interrupts of the AVR. 03
(b) Describe the normal and CTC modes of AVR timers. 04
(c) Explain how the SPI read and write operation works? 07
OR
Q.3 (a) Explain AVR instruction : SBI and CBI 03
(b) Explain BRANCH and CALL instruction in AVR microcontroller 04
with example.
(c) Explain PWM interfacing with AVR in C. 07
Q.4 (a) Explain the purpose of the status register. 03
(b) Describe the basic function of opto-isolator. 04
(c) Write a assembly program to toggle led after every 50 mili seconds. 07
OR
Q.4 (a) Write advantage of assembly language programming. 03
(b) Describe the basic operation of stepper motor with diagram. 04
(c) Write a assembly program to find biggest number from given 10 07
numbers.
Q.5 (a) Write down ATMEGA32 ADC features. 03
(b) Explain following AVR assembly instructions: 04
a) LDI b) IN
(c) Write a c program to blink two LED connected to output port with the 07
help of two different timers.
OR
Q.5 (a) Describe the function of the pins of the typical LCD. 03
(b) Explain the function of the DS1307 RTC registers. 04
(c) Write a c program to display input message from keyboard to 16 x2 07
LCD
*************

1
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – SUMMER 2021
Subject Code:2151001 Date:04/09/2021
Subject Name:Microcontroller and Interfacing (EC)
Time:10:30 AM TO 01:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

MARKS
Q.1 (a) How microcontroller is different from microprocessor? 03
(b) What is role of flags in microcontroller? Explain AVR Status register 04
(c) Draw and explain architecture of AVR Microcontroller. Explain 07
Programming model.

Q.2 (a) Write assembly language program to check status switch connected to 03
port pin PC0 ad show status on port pin PA0
(b) Write assembly language program to read data from PORT A and PORT 04
B. Add these data and store answer at data memory location 0x0800
(c) What is interrupt? What are the interrupts available in AVR 07
microcontroller? Explain GICR (Global Interrupt Control Register) and
TIMSK (Timer Interrupt Mask Register)
OR
(c) Why look up table is important for real life applications? Prepare look up 07
table for common anode seven segment displays for digits 0 to 9. Write
assembly or C program to send all seven segment codes stored in look up
table one by one to PORTB at the interval of 1 second.

Q.3 (a) What will be content of register R16 after execution of following 03
instructions?
LDI R16,0x55
LDI R17,0x22
LSL R16
EOR R16,R17
(b) Write assembly or C language instructions to do following tasks: 04
(1) Toggle port pin PD0
(2) Enable External interrupts
(c) Explain following assembly language instructions with suitable examples 07
(1) BLD (2) STS (3) LPM (4) BRNE (5) LSL (6) BRCC (7) CBR
OR
Q.3 (a) Explain conditional branch instructions BREQ and BRNE with examples 03
(b) Write assembly or C language instructions to do following tasks: 04
(1) Set pins PD0-PD3 output and PD4-PD7 input
(2) Enable Timer interrupts
(c) Write program to read water level sensor connected at port pin PA0. 07
Turn ON the relay if water level sensor output is logic LOW and Turn
OFF the relay if water level sensor output logic is HIGH. Consider that
relay is controlled by the transistor whose base terminal is connected at

1
port pin PC7 via series resistor of 220 Ω. Draw interfacing circuit
diagram and write program in assembly or C language.

Q.4 (a) Explain unconditional branch instructions JMP and RJMP with examples 03
(b) Three color common cathode LED (RED, BLUE and GREEN) is 04
connected to port pin PA0, PA1 and PA2 respectively. Write program in
Assembly OR C language to glow LED for color RED, BLUE and
GREEN at the interval of 1 second.
(c) Draw and explain interfacing diagram of LCD with AVR 07
Microcontroller. Use PORTD to connect data lines, RS with PB0, RW
with PB1 and Enable with PB2. Write C language program to display
Message “WEAR MASK” on the first line of LCD and “SOCIAL
DISTANCE” on second line of LCD.
OR
Q.4 (a) Draw interfacing diagram to interface DC motor with AVR 03
microcontroller with help of motor driver IC L293D. Use port pins PD0,
PD1 and PD2 to control the motor
(b) Write assembly or C language program to rotate DC motor in clockwise 04
direction for 2 second and anticlockwise direction for 2 second. Consider
connections as per interfacing diagram of Q.4(a).
(c) How many timers are there in ATMega32 microcontroller? What is need 07
of timers in embedded systems? Explain programming steps to use
timers. Write program to generate 100 Hz square wave on port pin PD0
using timer 0.

Q.5 (a) Analyze following Embedded C program instructions for AVR 03


Microcontroller:
DDRC=0xFF;
unsigned char mydata=0x05;
mydata=mydata<<1;
PORTC=mydata;
Explain all above four instructions. What will be value of mydata
variable and content of PORTC after executing all four instructions?
(b) Write assembly language program to generate delay of 1 ms using pure 04
software delay. Consider crystal frequency 8 MHz.
(c) Explain I2C bus protocol. Explain how master writes the value 1111101 07
to a slave with address 1001101 with help of timing diagram.
OR
Q.5 (a) Explain advantage of SPI bus over traditional parallel bus 03
(b) What is role of UBRR in serial communication? What value should be 04
loaded in UBRR to achieve baud rate of 19,200 if crystal frequency is 8
MHz?
(c) Draw interfacing diagram to interface Single phase AC, FAN and LED 07
Tube Light with AVR microcontroller with help of either solid state or
electromechanical relay. Write program to switch ON AC when external
interrupt 0 occurs, switch ON FAN when external interrupt 1 occurs and
Tubelight when external interrupt 2 occurs.

*************

2
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=[Link] 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
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER– V (New) EXAMINATION – WINTER 2019
Subject Code: 2151001 Date: 21/11/2019
Subject Name: Microcontroller and Interfacing (EC)
Time: 10:30 AM TO 01:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) What are the criteria for choosing a microcontroller 03


(b) Draw and explain the status register of AVR Microcontroller 04
(c) And explain internal architectural diagram of AVR microcontroller. 07
Q.2 (a) Write a program to get data from PINB and send it to the I/O register of PORT C 03
continuously.
(b) What is assembler directive? Explain following assembler directive with proper 04
example.
1 .org 2. .include
(c) What is the difference between interrupt and polling? Write the steps in executing an 07
interrupt.
OR
(c) Draw TIMSK register and explain each bit. Show the instructions to enable the 07
timer0 overflow interrupt and timer2 compare match interrupt.
Q.3 (a) Explain below instruction: 03
1. STS 2. LDS 3. IN
(b) Write a program to load the PORTB register with the value of 0x55, and complement 04
PORTB 700 times.
(c) Draw matrix keyboard connection to AVR and also draw flow chart for identifying the key 07
pressed.
OR
Q.3 (a) Explain below pins of ATMega32 03
1. TCK 2. RXD 3. RESET’
(b) Explain any two branch instruction with proper example. 04
(c) Explain TIFR register and also write the steps to program timer0 in normal mode. 07
Q.4 (a) Explain simplex, half and full duplex transfers of data communication 03
(b) Draw the diagram of ATMega32 connection to RS232 and explain how 04
communication is established?
(c) Write an embedded C program to find maximum of 5 numbers 07
OR
Q.4 (a) What is the difference between RISC and CISC architecture? 03
(b) Draw DC motor interfacing with AVR 04
(c) Write an embedded C program to arrange 5 data in descending order. 07
Q.5 (a) Which are the different features of ADC in AVR? 03
(b) Give short note on I2C BUS protocol. 04
(c) Write the steps in programming the ADC converter using polling 07
OR
Q.5 (a) Explain RTC interfacing with AVR 03
(b) Find the value for TCCR0 for Phase correct PWM, inverted PWM wave generator 04
and prescaler = 256.
(c) Draw diagram of SPI Bus Vs. Traditional Parallel Bus connection to Microcontroller. 07
Also explain how SPI bus protocol works.
*************
1
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – SUMMER 2019
Subject Code: 2151001 Date: 03/06/2019
Subject Name:Microcontroller and Interfacing
Time: 02:30 PM TO 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
MARKS
Q.1 (a) Explain the criteria for selecting a microcontroller. 03
(b) Describe the status register of AVR microcontroller. 04
(c) Write short notes on AVR data memory. 07

Q.2 (a) Write the difference between IN and LDS instruction of AVR 03
microcontroller
(b) Explain the feature of RISC architecture 04
(c) Assume that the data memory location 0x315 contains FD(hex). Write 07
an assembly language program to convert it into decimal and save the
result into the location 0x322,0x323 and 0x324 where least significant
digit store into 0x322.
OR
(c) Write an assembly language program to transfer the value 41H serially 07
(one bit at a time) via pin PB1. Put one high at start and end of the data.
Send the LSB first.
Q.3 (a) What is MACRO and how it is used? 03
(b) Explain the following instruction with example 04
1. NEG 2. LSL 3. SWAP 4. SBI
(c) Assuming XTAL = 8 MHz write an assembly language program to 07
toggle PB5 once per millisecond.
OR
Q.3 (a) What are assembler directives? Explain any three assembler directives. 03
(b) Explain the following instruction with example 04
1. SBIS 2. IJMP 3. RET 4. RCALL
(c) Discuss SPI bus protocol with reference to AVR microcontroller 07

Q.4 (a) Write an AVR ‘C’ program to toggle all bits of port B continuously with 03
a some delay. Use Timer0, normal mode and no prescaler option to
generate time delay.
(b) Which are the different timers are available in ATmega32. Explain the 04
times 0 with necessary diagram.
(c) Write an AVR ‘C’ program using Timer0 and Timer1 interrupt, generate 07
square wave on PB1 and PB7 respectively while transferring data from
port C to port D.
OR
Q.4 (a) Write an AVR ‘C’ program to get a byte of data from port ‘C’ if it is 03
less than 100 , send it to port B otherwise send it to port D.
(b) Explain the functionality of each bit of TCCR0 and TIFR with necessary 04
diagram.
(c) Explain the connection of ATmega32 with RS232. Write an AVR ‘C’ 07
program to receive character from the serial port if it is ‘a’ to ‘z’ change
1
it to capital letters and transmit it back. Use port A to receive data set
baud rate at 9600, 8-bit data and 1 stop bit.
Q.5 (a) Draw and explain DC motor connection using darlington transistor. 03
(b) Explain the functioning of DDRX, PORTX, and PINX registers with 04
necessary example.
(c) Explain ATmega32 ADC feature and write an AVR ‘C’ program using 07
interrupt and polling method to convert analog input into digital form.
Assume port A as input port and port B and port D as an output port
OR
Q.5 (a) Explain the different types of stepper motor and its interfacing diagram 03
with AVR microcontroller
(b) Draw the interfacing diagram of keyboard with AVR microcontroller 04
and explain its working.
(c) With neat diagram and appropriate programming example discuss the 07
Interfacing of LCD with AVR microcontroller.

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–V (NEW) EXAMINATION – WINTER 2018
Subject Code:2151001 Date:20/11/2018
Subject Name:Microcontroller and Interfacing (EC)
Time: 10:30 AM TO 01:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
MARKS
Q.1 (a) Discuss criterion to select microcontroller. 03
(b) Explain conditional branch instructions BREQ and BRNE with 04
examples. Write an AVR ALP to toggle PA0 pin 100 times using
conditional branch instruction.
(c) Discuss SPI bus protocol with reference to AVR microcontroller. 07

Q.2 (a) Write an AVR ALP to find number of 0s in 0x99. 03


(b) Explain the functions of following pins: 1. TCK 2. RXD 3. AREF 4. 04
RESET.
(c) What are the serial interrupts available in AVR microcontroller? Write 07
interrupt routine to receive data through serial port (RxD) pin and
display data on PORTB. Initialize serial port registers and enable serial
port interrupts in main program.
OR
(c) Write an AVR C program to convert (1) packed BCD 0x29 to ASCII 07
and display the bytes on PORT B and PORT C (2) ASCII digits of ‘4’
and ‘7’ to packed BCD and display them on PORT B.
Q.3 (a) Write an AVR ALP to load I/O register of Port B with the value 0x55 03
and complement I/O register of Port B 10 times.
(b) Explain usage of AVR status register. 04
(c) Explain with diagram, DC motor interfacing with AVR. 07
OR
Q.3 (a) Write an AVR C program to toggle all the bits of Port B 100 times. 03
(b) What is need of RTC? Explain interfacing of RTC with AVR 04
microcontroller.
(c) Draw Interfacing diagram to interface LCD with AVR Microcontroller. 07
Use Port D to drive data lines. Connect RS pin of LCD with PA0 and
Enable pin with PA1. Ground R/W pin of LCD.
Q.4 (a) Compare: CISC and RISC architecture. 03
(b) List different shift and rotate instructions and explain any two with 04
proper example.
(c) Write an AVR C program to generate square wave of 60% duty cycle 07
on Port B.1 bit using Timer0. Analyze the program.
OR
Q.4 (a) Discuss the steps for execution of branch instruction in AVR 03
(b) List addressing modes of AVR and explain any two with example. 04
(c) Write an AVR C program to generate square wave with a period of 07
12.5microsecond on Port B.3 bit using Timer0 in normal mode. Assume
crystal frequency = 8 MHz.
Q.5 (a) Explain Bitwise AND and Bitwise OR operators with example. 03

1
(b) Write an AVR ALP to perform 253/10, store remainder in R20 register 04
and quotient in R21 register.
(c) Explain Look-up table concept in AVR with example. 07
OR
Q.5 (a) Compare: Macros and Subroutines. 03
(b) Write an AVR ALP for multiplication of two 8 bit data. 04
(c) Discuss I2C bus protocol with appropriate diagram. 07

*************

2
Seat No.: ________ Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE - SEMESTER–V (NEW) - EXAMINATION – SUMMER 2018
Subject Code:2151001 Date:02/05/2018
Subject Name:Microcontroller and Interfacing (EC)
Time:02:30 PM to 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
MARKS
Q.1 (a) Define the word microcontroller and compare it with the word 03
microprocessor.
(b) List the flags associated with AVR microcontroller and explain any three 04
flags with proper example.
(c) Draw the internal architectural block diagram of AVR microcontroller 07
and explain the function of each block in brief.
Q.2 (a) Write an ALP to toggle I/O register of port B continuously forever. 03
(b) Define addressing mode. Discuss Data Indirect addressing Mode for 04
AVR with proper example.
(c) Discuss the AVR data memory in detail. 07
OR
(c) Discuss SPI bus protocol with reference to AVR microcontroller. 07
Q.3 (a) Draw and explain Harvard Architecture. 03
(b) Draw the pin diagram of AVR microcontroller and explain the functions 04
of following pins.
1. MISO 2. RESET
3. RXD 4. TCK

(c) Explain following instructions with proper example. 07

5. LDI 6. ROL 7. LPM 8. ASR

9. SWAP 10. LDD 11. NEG

OR
Q.3 (a) Draw and explain TCCR0 register for ATMega32. 03
(b) Explain the functioning of DDRX, PORTX, and PINX registers with 04
appropriate example.
(c) Discuss the steps for execution of branch instruction in AVR. 07
List different branch instructions and explain any two with proper
example.
Q.4 (a) List the features and advantages of RISC Architecture. 03
(b) Write an ALP for addition of two 16 bit data for AVR microcontroller. 04
(c) Assuming that XTAL=8MHz, Write a program to generate a square wave with 07
a period of 12.5 µsec on pin PORTB.3. Explain your algorithm with neat flow
chart and proper comments.

1
OR
Q.4 (a) Explain in brief the execution process of interrupts with reference to AVR 03
microcontroller.
(b) Write a brief technical note on serial data communication with reference 04
to AVR microcontroller.
(c) Write a program in assembly/embedded C to arrange the five different 07
data stored in memory in ascending order.
Q.5 (a) Explain with diagram, stepper motor interfacing with AVR. 03
(b) Write a brief technical note on ADC peripheral of AVR microcontroller. 04
(c) Assume that bit PB4 is an input and represents the condition of a door 07
alarm. If it goes LOW, it means that the door is open. Monitor the bit
continuously. Whenever it goes LOW, send a High-to-Low pulse to port
PC5 to turn ON a buzzer. Draw the flow chart and write an ALP for it.
OR
Q.5 (a) What is assembler directives? Explain any three assembler directives in 03
brief.
(b) Write an ALP/Embedded C program to create a square wave of 50% duty 04
cycle on pin PORTB.5 bit. Timer 0 is used to generate the time delay.
(c) With neat diagram and appropriate programming example discuss the 07
interfacing of LCD with AVR microcontroller.

*************

You might also like