Question bank on Microcontroller 8051/AT89C51. Total 98 questions. Covering questions on introduction, programming, timers of 8051, serial communication of 8051, interrupts of 8051, memory interfacing, and applications.
1. Dr. Nilesh Bhaskarrao Bahadure
School of Technology
Department of Electronics Engineering
Sanjay Ghodawat University Kolhapur, Maharashtra
Question Bank
Introduction & Programming of 8051:
1. Explain the differences between Microprocessor based system and Microcontroller based system.
2. What is OTP, explain OTP in details.
3. Explain the applications of microcontroller.
4. What is embedded microcontroller?
5. List different 8051 family microcontroller with their features indicating serial port, timers, interrupt
sources and memories.
6. List the differences between 8051, 8052, 8031, 8032, 8751, 8752, AT89C2051, AT89C51, and AT89C52.
7. Explain the features of Intels 8051 Microcontroller.
8. Draw and explain the architecture of Microcontroller 8051.
9. What is the Program status word explains in details with suitable example.
10. Explain register structure of the 8051 Microcontroller.
11. Explain following registers of the 8051 Microcontroller DPTR, PC and SP.
12. Explain the memory organization of the 8051 Microcontroller.
13. What is the special function register, what are their significances in the 8051 Microcontroller?
14. What are the addressing modes? Explain addressing modes of the Microcontroller 8051 in details.
15. Write an ALP to add RAM location contents from 40 44h. Store the result of low byte in register
A and higher byte in register R7.
16. Write a program to add two 16 bit numbers 2345h and 567Ch. Place the sum in register R7 and
R6. R6 should have the lower byte of the result.
17. Write an ALP to add 5 BCD numbers present in RAM memory location starting at 40h. Store the
result of lower byte in register A and higher byte in register R7.
18. Write an ALP to transfer value 41h serially via pin P2.1 .Put two high at the start and two high at
the end of the data. Send the byte LSB first.
19. Write a program to copy data byte serially one bit at a time from port pin P1.7 and save it in
register R2. The byte comes in with LSB first.
20. Write an ALP to count even and odd numbers from the 10 bytes present in the memory location
from 30h. Put the even and odd count in register R7 and R6 respectively.
21. Write an ALP to count positive and negative numbers from the 10 bytes present in the memory
location from 30h. Put the +ve and ve count in register R7 and R6 respectively.
22. Write an ALP to find smallest byte from 10 bytes present in the memory location from 30h. Put
the smallest byte in register R7.
Question Bank - Microcontroller 8051 Page 1
2. Dr. Nilesh Bhaskarrao Bahadure
23. Write an ALP to find largest byte from 10 bytes present in the memory location from 30h. Put the
largest byte in memory location 7Fh.
24. Write an ALP to find cubes of a number 0 - 6 and put the result in the memory location from 30h.
25. Write an ALP to count byte 00h from 20 bytes present in the memory location from 30H. Put the
result in the external memory at 0200h.
26. Write an ALP to count byte 55h from 20 bytes present in the memory location from 30H. Put the
result in the external memory at 0200h.
27. Assume that register A has packed BCD number write a program to convert packed BCD number
to two ASCII numbers and place them in register R2 and R6.
28. Explain the following instruction JMP @A + DPTR, CALL, RET, INC DPTR, SWAP.
29. Explain absolute and long call with suitable examples.
30. State the contents of RAM location after the following program
SETB PSW.3
MOV R1, #67H
MOV R5, #34H
MOV R7, #0ACH
MOV R2, #55H
31. Write a program to add 3 to the accumulator 10 times. Save the result in register R7.
32. Write a program to load accumulator with AAh and complement the accumulator 700 times.
33. Find the size of the delay in the following program. Assume that the crystal frequency for the 8051
Microcontroller is 11.0592 MHz.
Delay: MOV R3, #200
Here: DJNZ R3, Here
RET
34. Find the size of the delay in the following program. Assume that the crystal frequency for the 8051
Microcontroller is 11.0592 MHz
MOV R3, #250
Here: NOP
NOP
NOP
NOP
DJNZ R3, Here
RET
35. Find the size of the delay in the following program. Assume that the crystal frequency for the 8051
Microcontroller is 11.0592 MHz
MOV R2, #200
Rep: MOV R3, #250
Here: NOP
NOP
DJNZ R3, Here
DJNZ R2, Rep
RET
36. Write a program to clear 16 RAM locations starting at RAM address 60h.
Question Bank - Microcontroller 8051 Page 2
3. Dr. Nilesh Bhaskarrao Bahadure
37. Write an ALP to find number of 1s in a given byte. Assume byte is available in register R6.
38. Written an ALP to obtained 2s complement of register R6 and store the result at internal RAM
30h.
39. Write an ALP to find twos complement of 16 bit number present in the internal RAM 31h-30h,
memory location 31h consist higher byte and 30h consist lower byte. Put the result in the same
memory location.
40. Write an ALP to find number of ones in a given byte and stored the result in external memory
location at 4000h.
41. Write a program to
(a) Write a value 55h to the RAM locations 40h - 4Fh
(b) Add all these RAM location contents together and save the result in RAM location 60h and
61h.
42. Explain the following pins of the 8051 Microcontroller EA, PSEN, ALE, and RXD.
43. Draw and explain power on reset circuit.
44. What are the reset values for the register of 8051 Microcontroller? Also explain the importance of
Port P0 and Port P2.
45. Write an ALP to toggle all the bits of P0, P1 and P2 every second. Assume a crystal frequency of
11.0592 MHz
46. Write an ALP
(a) To create a square wave of 50% duty cycle on bit 0 of port 1.
(b) To create a square wave of 66% duty cycle on bit 3 of port 1.
(c) To create a square wave of 33% duty cycle on bit 4 of port 1.
Timers of 8051 Microcontroller:
47. Explain the registers of timers. Also explain TMOD and TCON registers.
48. Explain the following:
(a) 13 - bit timer mode
(b) 16 - bit timer mode
(c) 8 - bit timer mode or auto reload mode
(d) Split timer mode
49. Draw and explain timer/counter 0 and timer/counter 1 for the mode 1
50. Draw and explain timer/counter 0 and timer/counter 1 for the mode 2
51. Explain how to initialize the timer with suitable example.
52. Explain 13 - bit timer mode and split timer mode of timers 8051 Microcontroller.
53. Assume that XTAL = 11.0592 MHz Write an ALP to generate pulse width of 5ms on port pin P2.3
using timer 0.
54. Assume that XTAL = 11.0592 MHz, write a program to generate a square wave of 2 KHz frequency
on pin P1.5 using timer 1.
55. Write an assembly language program to generate square wave of 200 µSecond frequency using timer
1 in mode 2. Assume that XTAL = 11.0592 MHz
Question Bank - Microcontroller 8051 Page 3
4. Dr. Nilesh Bhaskarrao Bahadure
Serial Communication of 8051 Microcontroller:
56. What is serial communication? Explain integrated means of serial communication.
57. Explain the type of transmission used in serial communication.
58. Explain the following: Simplex communication, Duplex Communication and Asynchronous serial
communication in details with examples.
59. Explain asynchronous serial communication using suitable example.
60. What are the means of data transfer rate in serial communication explain in details.
61. Explain in details how to write to the serial port.
62. Explain SBUF and SCON register of 8051 serial communication.
63. Explain the importance of transmit interrupt flag and receive interrupt flag bit of serial communi-
cation.
64. Write an ALP for the 8051 to transfer character ‘A’ serially at 4800 baud rate, continuously.
65. Write a program to transfer the message “YES” serially at 9600 baud rate, 8 bit data, and 1 stop
bit continuously.
Interrupts of 8051 Microcontroller:
66. Explain the differences between Interrupts and Polling.
67. Explain the Interrupts of 8051 Microcontroller in details.
68. Draw and explain interrupt structure of 8051 Microcontroller also explain enabling and disabling
the interrupts.
69. Explain Interrupt enable and Interrupt priority register.
70. Show the instruction to
(a) Enable serial interrupt, timer 0 interrupt and external hardware interrupt 1.
(b) Disable timer 0 interrupt.
(c) Show how to disable all the interrupt with a single instruction.
71. Program the IP register to assign the highest priority to external interrupt 1 then discuss what
happen if INT0, INT1 and TF0 are activated at the same time.
72. Assume that after reset the IP register is set by the instruction MOV IP, 0Ch. Discuss the sequence
in which the interrupts are serviced.
Memory Interfacing with 8051 Microcontroller:
73. Show that the design of an 8031 based system with 8K bytes of program ROM and 8K bytes of data
ROM.
74. Design the interfacing system of 16 K x 8 data RAM with 8051 Microcontroller. Use starting
addresses 8000h.
Question Bank - Microcontroller 8051 Page 4
5. Dr. Nilesh Bhaskarrao Bahadure
75. Design the interfacing of 8031 based system with 16 KB program space, 16 KB of data ROM starting
at 0000h and 16 KB of NV - RAM starting at 8000h. Show the design using 74LS138 for the address
decoder.
76. Design the interfacing system of 8051 Microcontroller with 256K x 8 data NV - RAM. Also write
an assembly language program to read the contents of memory location from 20000h and store the
contents in internal memory location form 30h.
77. Find the address range of the memory design for Y0, Y3 and Y6 of the 74LS 138 for the given
diagrammed design shown in figure 1
Figure 1: Figure for example 77
Applications of 8051/AT89C51:
78. Design an application to interface LED with the port pin P1.2 and write an assembly language
program to blink the LED.
79. Design an application to interface 7-segment LED with 8051 and write an ALP to display number
8 on it.
80. Design an application to interface 2 Seven - segment LED with 8051 and write an ALP to display
3 and 5 on it.
81. . Design an application to interface 7-segment LED with 8051 Microcontroller and write an ALP
to display 0 - 9 on it
82. Design an application to interface 2*16 LCD with 8051 and write an ALP to display “SGU Kolhapur”
on it.
83. Design an application to interface stepper motor with 8051 and write an ALP to rotate stepper
motor clockwise continuously.
84. Design an application to interface stepper motor with 8051 and write an ALP to rotate stepper
motor anticlockwise continuously.
85. A switch is connected to pin P2.7. write a program to monitor the status of switch and perform the
following.
(a) If SW = 0 ; the stepper motor moves clockwise
(b) If SW = 1 ; the stepper motor moves anticlockwise
86. Design an application to interface ADC 0804 with 8051.
87. Interface ADC 0804 with 8051 Microcontroller. write an ALP to brings an analog input into register
A and then stored then in the internal memory location from 30h onwards.
Question Bank - Microcontroller 8051 Page 5
6. Dr. Nilesh Bhaskarrao Bahadure
88. Design an application to interface DAC 0808 with 8051 Microcontroller. Write an ALP to generate
a sine wave continuously on DAC. Use port P1 of 8051.
89. Interface DAC 0808 with 8051 µC. Write an ALP to generate a stair- step ramp on port P1.
90. Interface DAC 0808 with 8051 µC. Write an ALP to generate reverse sawtooth waveform using port
P1.
91. Interface DAC 0808 with 8051 µC. Write an ALP to generate triangular waveform at the DAC
output. Generate 200 cycles. Use port P1.
92. Design an application to interface 8 * 8 matrix keyboards with 8051 Microcontroller.
93. Interface 4 * 4 matrix keyboards with 8051 Microcontroller. Write an ALP to read the keypad and
send the ASCII code of pressed key to the port P0.
P1.0 - P1.3 Connected to rows (output)
P2.0 - P2.3 Connected to columns (Input)
94. Design an application to interface 4 * 4 matrix keyboards with 8051 Microcontroller.
95. Design an application for temperature sensor LM 35 with 8051 Microcontroller. Display temperature
reading value on the LCD.
96. Design an application for interfacing of strain gauge with 8051 Microcontroller.
97. Design an application for interfacing of LDR sensor with 8051 Microcontroller.
98. Design an application to interface two 8051 Microcontroller, write a program to transmit character
byte serially from one microcontroller and receive serially by other microcontroller. Also display
received character byte on display device connected with the port P1.
Question Bank - Microcontroller 8051 Page 6