GTU last year question papers
GUJARAT TECHNOLOGICAL UNIVERSITY
BE- Vth SEMESTER–EXAMINATION – MAY/JUNE – 2012
Subject code: 151001
Subject Name: Microcontroller and Interfacing
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
Q.1 (a) Answer Following Questions
1) What precaution we should take before using SUBB
2) What are the conditions for setting the OV flag?
3) Find the system frequency of an 89C51 if the machine
cycle period is 0.546 μs.
4) Under which condition 8051 with internal 4K program
memory would access external program memory?
5) What are the maximum sizes of program memory and
data memory that may be interfaced with MCS-51?
6) What is the difference between a Timer and a Counter?
7) What is the difference between MOVC and MOVX
(b) Draw schematic diagram for 8051 minimum hardware
configuration. Explain function of power – on – reset circuit.
Q.2 (a) Draw a schematic diagram of 8051 interfaced with 2K
external RAM. With reference to interface diagram drawn,
give the range of memory for which memory can be accessed.
(b) Write a program to check if the character string of length 7,
stored in RAM location40H onwards is a palindrome. If it
is, output Y to P1. Hint: A palindrome is a string in which
the characters are same whether the string is read in forward or reverse direction.
(b) Assume that input at port P1 is data for temperature. Two
LEDs are connected at P0.0 (RED) and P0.1 (GREEN)
with their anodes pulled up through 820_ resistor and
cathodes are connected with pins. LEDs Write a program
to acquire temperature data and indicate the status on LED
as below. Note: It is require continuously monitoring the
temperature and indicating status on LEDs.
If TEMP _ 10° RED LED ON and GREEN LED
If 10° < TEMP _ 80° RED LED OFF and GREEN
IF TEMP > °80 RED LED ON and GREEN LED
Q.3 (a) Sixteen random numbers are stored in an array, starting
from location 40H. Write an assembly program to count
the number of non-zero elements in this array and store it
in location 30H.
(b) Write an 8051 C program to convert 8-bit binary data to
decimal and display the digits on P0,P1, and P2
Q.3 (a) Write a program to calculate the average of an array of
unsigned positive integers. The array starts from 41H and
number of terms in the array is available in location 40H.
Store the calculated average in location 3FH.
(b) Write an 8051 C program to toggle all the bits of P0 and P2
continuously with a 250ms delay. Use the inverting operator
Q.4 (a) Answer Following:
1) In general, a 12 MHz crystal is used for XX51-based
systems. However, in certain cases, a frequency of
11.0592 is preferred. What is the reason behind it?
2) Why there is no Sign-flag in MCS-51?
(b) Solve the following:
1) Calculate the reload value for Timer 1 in mode 2 to
generate a baud rate of 2400, if 8051 is interfaced with
a 12 MHz crystal.
2) Find the time delay generated by the following routine
if the XTAL = 22 MHz.
HERE : MOV R0,#200
AGAIN : DJNZ R0,AGAIN RET
Q.4 (a) Write a program to generate a square wave with frequency
of 10KHz and with 50% duty cycle using Timer 0. Assume
the external crystal frequency of 12 MHz.
(b) Timer 0 is used as a counter, and Timer 1 is used as time
base of 1 second. Write an assembly program to find
frequency of signal connected at P3.4 (counter input for
Timer 0). Assume XTAL = 22MHz.
Q.5 (a) Draw schematic diagram of 8051 interfaced with
ADC08 . Use the 8051 clock to generate necessary clock
signal for ADC08 . Use P1 for Data line connection and P2 for other control signals.
(b) Write either assembly or C program for above circuit to
convert analog signal into digital and store it in internal RAM.
Q.5 (a) Draw a schematic diagram of 8051 interfaced with unipolar
stepper motor. Give reason, one need driver IC or circuit
for interfacing stepper motor with 8051.
(b) Write a program to rotate a stepper motor, as interfaced in
above problem, by 64° in clockwise direction. Assume the
motor has a step angle of 2°. Use the 4 – step sequence.