Sample Questions of Microcontroller Course 1
Sample Questions of Microcontroller Course 1
Unit 1
Unit 2
16. Calculate time required by PIC microcontroller running on internal oscillator set at 4 MHz
for following instructions 1) NOP 2) MOVLE 0x3B 3) MOVFF 0x020, 0x120
17. With help of timing diagram, explain instruction cycle of PIC18F4520 microcontroller
18. Explain different types of addressing modes in PIC18F4520 microcontroller
19. Explain working of any four instructions with immediate addressing mode.
20. Explain working of any four instructions with direct addressing mode.
21. Explain working of any four instructions with register indirect addressing mode.
22. Explain 4 different assembly instructions which can be used to clear content of working
register.
23. Explain any four, bit-oriented instructions by considering data in file register.
24. Explain any four logical instructions by considering data in file register.
25. Explain any four arithmetic instructions by considering data in file register.
26. Describe the CALL instruction and the role of the stack.
27. Explain how conditional branching works in PIC18Fxx assembly language. Give examples.
28. Explain how unconditional branching works in PIC18Fxx assembly language. Give
examples.
29. List the four rotate instructions in assembly language utilized in PIC18F4520
microcontroller and explain with suitable examples indicating relation with bits in STATUS
register. Also write addressing modes.
30. List the different types of compare and decrement instructions in assembly language
utilized in PIC18F4520 microcontroller and explain with suitable examples indicating
relation with bits in STATUS register. Also write addressing modes.
31. Explore the delay calculation in PIC18Fxx with suitable example.
32. List the arithmetic instructions utilized in PIC18Fxx microcontrollers and explain any two
with suitable examples.
33. Find the contents of WREG after execution of following code in each case
a. MOVLW 0x37
ADDLW 0xCA
b. MOVLW 0x37
IORLW 0xCA
c. MOVLW 0x37
XORLW 0xCA
34. Assume that the WREG has packed BCD. Write a program to convert packed BCD to two
ASCII numbers and place them in file register locations 6 and 7.
35. Compare and contrast the widely used data types for C programming on PIC18Fxx
microcontrollers, highlighting their sizes, ranges, and specific applications.
36. Explore the step-by-step procedure to implement a delay using embedded C for PIC18Fxx
microcontrollers using a simple delay loop technique. Give suitable example.
37. Write a C program to separate 5 decimal digits in unsigned integer variable using shift and
logical operators. Also draw flowchart of the program.
Unit 3
38. Explain I/O port structure of PIC18F4520 microcontroller with the help of Block diagram
and SFRs associated. What is pull up and pull-down registers? How do we use them.
39. Explain arrays and array pointer in embedded C programming.
40. Write a C program to combine data in two unsinged character variables into one unsigned
integer variable. Also draw flowchart of the program.
41. Write any embedded C program using Conditional statements.
42. Write a C program to blink LED connected on RC0 pin of PIC microcontroller 2 lacs times
and then switch it OFF. Also draw flowchart of the program.
43. Write an embedded C program to get byte of data from PORT B, wait for 1 second and
send it on PORT C.
44. Write an embedded C program to monitor PC5. If it is HIGH, send 55H to PORT B;
otherwise send AAH to PORT D .
45. Write an embedded C program to convert 11111101 [FD hex] to decimal and display the
digits on PORTB, PORTC, PORTD.
46. Find the PORT value after execution of each of the following
a. PORTB = 0 x 65 >> 2
b. PORTC = 0 x 39 << 2
c. PORTB = 0 x D4 >> 3
d. PORTB = 0 x A7 << 2
Unit 4
47. Explain functioning of Timer 0 with the help of its block diagram and associated SFRs.
48. Explain functioning of Timer 1 with the help of its block diagram and associated SFRs.
49. Explain functioning of Timer 2 with the help of its block diagram and associated SFRs.
50. Explain functioning of Timer 3 with the help of its block diagram and associated SFRs.
51. Write a C program to generate 50 Hz square wave of 75% duty cycle on RD0 pin using
Timer 0. Also draw flowchart of the program.
52. Write a C program to generate 400Hz square wave of 30% duty cycle on RD1 pin using
Timer 1. Also draw flowchart of the program.
53. Write a C program to generate 800Hz square wave of 40% duty cycle on RD1 pin using
Timer 2. Also draw flowchart of the program.
54. Write a C program to generate 800Hz square wave of 40% duty cycle on RD1 pin using
Timer 3. Also draw flowchart of the program.
55. Write a C program to blink LED at the rate of 100 ms ON and 100 ms OFF connected on
RD2 pin using Timer 0/Timer1/Timer2/Timer3. Also draw flowchart of the program.
56. Explain functioning of ADC module in PIC18F4520 microcontroller with the help of its
block diagram and associated SFRs.
57. Write a C program to convert analogue voltage on AN1 (or ANx) channel of ADC module
in PIC18F4520 to digital number. Explain important steps in program.
58. Explain UART communication module in PIC microcontroller.
59. With the help of timing diagram, explain UART protocol.
60. Write a C program to read and write data byte to EEPROM location. Also draw flowchart
of the program.
Unit 5
61. Explain interfacing of LCD display with PIC18F4520 microcontroller with the help of
connection diagram.
62. Explain interfacing of LCD display with PIC18F4520 microcontroller with the help of
connection diagram.
63. Write a C program to display ASCII string message on LCD. Also draw flowchart of the
program.
64. Write a C program to interface matrix key pad of 4 rows and 3 columns using pull up
resistors. Explain logic of key press detection and also draw flowchart of the program.
65. Write a C program to interface matrix key pad of 4 rows and 3 columns using pull down
resistors. Explain logic of key press detection and also draw flowchart of the program.
66. Write a C program to interface matrix key pad of 3 rows and 3 columns using pull up
resistors. Explain logic of key press detection and also draw flowchart of the program.
67. Write a C program to interface matrix key pad of 3rows and 2 columns using pull up
resistors. Explain logic of key press detection and also draw flowchart of the program.
68. Draw circuit diagram to interface unipolar stepper motor with PIC microcontroller. Write
C program to rotate stepper motor in clock wise direction by --X--- degree and in
anticlockwise direction by ---Y--- degree. Assume full step sequencing.
69. Draw circuit diagram to interface unipolar stepper motor with PIC microcontroller using
ULN2003 motor driver chip. Write C program to rotate stepper motor in clock wise
direction by --X--- degree and in anticlockwise direction by ---Y--- degree. Assume half step
sequencing.
70. Draw circuit diagram to interface bulb using relay and relay driver circuit. Write C program
to control relay by switch. Use RB0 pin for interfacing switch and use RC0 pin for relay
interfacing.
71. Draw circuit diagram to interface unipolar stepper motor using ULN2003 motor driver
chip. Write C program to control relay by switch. Use RB0 pin for interfacing switch and
use RC0 pin for relay interfacing.
72. With the help of connection diagram and timing diagram explain I2C protocol. Consider
PCF8575 I/O expander chip for explanation.
73. With the help of block diagram explain working of I2C module in PIC microcontroller.
74. With the help of timing diagram explain SPI protocol.
75. With the help of block diagram and associated SFRs explain working of PWM module in
PIC microcontroller. How is speed of DC motor controlled using PWM signal?
76. Write a C program to generate PWM signal of 1500 Hz of 60% duty cycle on RC2 pin of PIC
microcontroller using PWM module 1. Calculate numbers to be written to PR2 and CCPR1L
and CCP1CON register. (Note: Frequency and duty cycle will be changed randomly).
Unit 6
77. With the help of block diagram explain implementation of automatic porch light control
system using PIC microcontroller by considering only light sensor.
78. With the help of block diagram explain implementation of automatic porch light control
system using PIC microcontroller by considering both light sensor and motion sensor.
79. Write a C program to implementation automatic porch light control system using PIC
microcontroller by considering only light sensor.
80. Write a C program to implementation automatic porch light control system using PIC
microcontroller by considering both light sensor and motion sensor.
81. Write a C program to implement automatic temperature control system using PIC
microcontroller by considering LM35 temperature sensor. Consider heater as a control
element and assume set temperature of 45 degree Celsius. Assume suitable dead band
for upper and lower threshold of temperature. Draw connection diagram involving
temperature sensor and heater with relay driver circuit.
82. Write a C program to implement automatic soil moisture control system using PIC
microcontroller by considering conductivity sensor for soil moisture measurement.
Consider AC water pump as a control element. Assume suitable threshold for controlling
ON/OFF operation of motor pump. Draw connection diagram involving soil moisture
sensor and motor with relay driver circuit.
83. Write a C program to implement antitheft system using PIC microcontroller and motion
sensor. System must give buzzer indication on detection of thief in the detection zone of
motion sensor. Also draw connection diagram.
84. Write a C program for measurement of external frequency using Timer 0. Also draw block
diagram.
85. Write a C program for measurement of external frequency using Timer 1. Also draw block
diagram.