EEE 5th Semester - Embedded C Programming - EE3017 - Important Questions with Answer - Unit 4 - 8051 Serial Port and Interrupt Programming In C
EEE 5th Semester - Embedded C Programming - EE3017 - Important Questions with Answer - Unit 4 - 8051 Serial Port and Interrupt Programming In C
4th Semester
3rd Semester
- MA3151 MA3251
1st Semester
2nd Semester
Power System
Operation and Control
Control Systems - - EE3602 Open Elective 2
EE3503 Project Work /
Open Elective-1
Open Elective 3 Intership
Elective 1 Elective-4
Open Elective 4
Elective 2 Elective-5
Elective 7
Elective 3 Elective-6
Management Elective
All EEE Engg Subjects - [ B.E., M.E., ] (Click on Subjects to enter)
Circuit Theory Digital Logic Circuits Electromagnetic Theory
Environmental Science and Linear Integrated Circuits Discrete Time Systems and
Engineering and Applications Signal Processing
Electronic Devices and Electrical Machines I Electrical Machines II
Circuits
Power Plant Engineering Special Electrical Machines Transmission and Distribution
Power System Analysis Control Systems Power Electronics
Power System Operation Measurements and Design of Electrical Machines
and Control Instrumentation
Communication Engineering Solid State Drives Embedded Systems
Power Quality High Voltage Engineering Protection and Switchgear
Flexible AC Transmission Microprocessors and Electric Energy Generation,
Systems Microcontrollers Utilization and Conservation
Professional Ethics in Physics for Electronics Basic Civil and Mechanical
Engineering Engineering Engineering
Transforms and Partial Environmental Science and Problem Solving and Python
Differential Equations Engineering Programming
Engineering Physics Engineering Chemistry Numerical Methods
Engineering Graphics Technical English Object Oriented Programming
Principles of Management Total Quality Management
www.BrainKart.com
4931_Grace College of Engineering,Thoothukudi
UNIT – IV
8051 SERIAL PORT AND INTERRUPT PROGRAMMING
Prepared by,
EE33017_ECP
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
www.BrainKart.com
4931_Grace College of Engineering,Thoothukudi
UNIT 4
TWO MARKS
If data can be transmitted and received, it is a duplex transmission. If data transmitted one way a time, it
is referred to as half duplex. If data can go both ways at a time, it is full duplex
2. Define Framing?
Asynchronous serial data communication is widely used for character-oriented transmissions. Each
character is placed in between start and stop bits, this is called framing. Block-oriented data transfers
use the synchronous method.
The rate of data transfer in serial data communication is stated in bps (bits per second). Another widely
used terminology for bps is baud rate
The standard was set long before the advent of the TTL logic family, its input and output voltage levels
are not TTL compatible. In RS232, a 1 is represented by -3 ~ -25 V, while a 0 bit is +3 ~ +25 V, making -3
to +3 undefined.
EE33017_ECP
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
www.BrainKart.com
4931_Grace College of Engineering,Thoothukudi
8. With XTAL = 11.0592 MHz, find the TH1 value needed to have the following baud rates. (a) 9600 (b)
2400 (c) 1200?
Solution: The machine cycle frequency of 8051 = 11.0592 / 12 = 921.6 kHz, and 921.6 kHz / 32 = 28,800
Hz is frequency by UART to timer 1 to set baud rate. (a) 28,800 / 3 = 9600 where -3 = FD (hex) is loaded
into TH1 (b) 28,800 / 12 = 2400 where -12 = F4 (hex) is loaded into TH1 (c) 28,800 / 24 = 1200 where -24
= E8 (hex) is loaded into TH1
SBUF is an 8-bit register used solely for serial communication .For a byte data to be transferred via the
TxD line, it must be placed in the SBUF register . The moment a byte is written into SBUF, it is framed
with the start and stop bits and transferred serially via the TxD line . SBUF holds the byte of data when it
is received by 8051 RxD line . When the bits are received serially via RxD, the 8051 deframes it by
eliminating the stop and start bits, making a byte out of the data received, and then placing it in SBUF
10. What
EE33017_ECP is the Use of SCOn
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
www.BrainKart.com
4931_Grace College of Engineering,Thoothukudi
SCON is an 8-bit register used to program the start bit, stop bit, and data bits of data framing, among
other things
11.what is the value loaded to the register for various baud rate?
EE33017_ECP
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
www.BrainKart.com
4931_Grace College of Engineering,Thoothukudi
Interrupts ƒ Whenever any device needs its service, the device notifies the microcontroller by sending it
an interrupt signal ƒ Upon receiving an interrupt signal, the microcontroller interrupts whatever it is
doing and serves the device ƒ The program which is associated with the interrupt is called the interrupt
service routine (ISR) or interrupt handler
14.Define Polling.
Polling can monitor the status of several devices and serve each of them as certain conditions are met ¾
The polling method is not efficient, since it wastes much of the microcontroller’s time by polling devices
that do not need service
PART B
1. Explain the characteristics and operations of mode0, mode1, mode2, mode 3 in 8051 with neat
diagram.
2. What are the types of timer? Explain TMOD How to calculate the values to be loaded into the TL
and TH registers?
EE33017_ECP
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
www.BrainKart.com
4931_Grace College of Engineering,Thoothukudi
3. Write an 8051 C program to toggle all the bits of port P1 continuously with some delay in between.
Use Timer 0, 16-bit mode to generate the delay.
4. a)Write an 8051 C program to toggle all bits of P2 continuously every 500 ms. Use Timer 1, mode 1 to
create the delay.
b) Assume that a 1-Hz external clock is being fed into pin T1 (P3.5). Write a C program for counter 1 in
mode 2 (8-bit auto reload) to count up and display the state of the TL1 count on P1. Start the count at
0H.
5. A switch is connected to pin P1.2. Write an 8051 C program to monitor SW and create the following
frequencies on pin P1.7: SW=0: 500Hz SW=1: 750Hz, use Timer 0, mode 1 for both of them.
6. Write the Steps to programming the 8051 to transfer and receive character bytes serially?
7. Write a C program for 8051 to transfer the letter “A” serially at 4800 baud continuously. Use 8-bit
data and 1 stop bit.
8. Write an 8051 C program to transfer the message “YES” serially at 9600 baud, 8-bit data, 1 stop bit.
Do this continuously.
9. Upon activation of an interrupt, the microcontroller goes through the following steps, write steps and
type of interrupt?
10. Write a C program using interrupts to do the following: (a) Receive data serially and send it to P0 (b)
Read port P1, transmit data serially, and give a copy to P2 (c) Make timer 0 generate a square wave of 5
kHz frequency on P0.1 Assume that XTAL = 11.0592 MHz. Set the baud rate at 4800.
EE33017_ECP
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
Click on Subject/Paper under Semester to enter.
Probability and Environmental Sciences
Professional English complex function - and Sustainability -
Professional English - - II - HS3252 MA3303 GE3451
I - HS3152
Statistics and Electromagnetic Transmission and
Matrices and Calculus Numerical Methods - Theory - EE3301 Distribution - EE3401
4th Semester
3rd Semester
- MA3151 MA3251
1st Semester
2nd Semester
Power System
Operation and Control
Control Systems - - EE3602 Open Elective 2
EE3503 Project Work /
Open Elective-1
Open Elective 3 Intership
Elective 1 Elective-4
Open Elective 4
Elective 2 Elective-5
Elective 7
Elective 3 Elective-6
Management Elective
All EEE Engg Subjects - [ B.E., M.E., ] (Click on Subjects to enter)
Circuit Theory Digital Logic Circuits Electromagnetic Theory
Environmental Science and Linear Integrated Circuits Discrete Time Systems and
Engineering and Applications Signal Processing
Electronic Devices and Electrical Machines I Electrical Machines II
Circuits
Power Plant Engineering Special Electrical Machines Transmission and Distribution
Power System Analysis Control Systems Power Electronics
Power System Operation Measurements and Design of Electrical Machines
and Control Instrumentation
Communication Engineering Solid State Drives Embedded Systems
Power Quality High Voltage Engineering Protection and Switchgear
Flexible AC Transmission Microprocessors and Electric Energy Generation,
Systems Microcontrollers Utilization and Conservation
Professional Ethics in Physics for Electronics Basic Civil and Mechanical
Engineering Engineering Engineering
Transforms and Partial Environmental Science and Problem Solving and Python
Differential Equations Engineering Programming
Engineering Physics Engineering Chemistry Numerical Methods
Engineering Graphics Technical English Object Oriented Programming
Principles of Management Total Quality Management