SlideShare a Scribd company logo
Lab 5: 20 points
EE 337: Microprocessors Laboratory (Spring 2021)
Section: S2 (Third year UG)
Indian Institute of Technology Bombay
Date: Feb 17, 2021
Before attempting this lab, go through the video lectures and notes on interrupts, timers
shared in the course Teams page and website.
1. [10 points] You will use the built-in hardware timers in 8051 to generate delays. This is in
contrast to the software delay subfunctions you had used in the previous labs.
• Write a subroutine that will use a 16-bit number as the count value to program the
timer T0 to generate a proportional delay.
Recall that the 8051 timers count up. These generate an interrupt (if enabled to do
so) when the count wraps around from FFFFH to 0000H. If we want a timer to time-out
after N cycles, it should be loaded with −N (i.e., 2’s complement of N).
So the subroutine should subtract the 16-bit number from 0000H and load the result as
the initial count in T0. While debugging the program with single stepping, you could
consider a count value of 1, and load the timer register with -1, so that it overflows
at the first increment itself. In actual use, a different count has to be stored.
• Write a program that will use the above subroutine to blink the onboard LEDs such
that these are ON for one second and OFF for one second continuously. Adjust the
timer count and the number of times the delay subroutine is called to make the ON
and OFF period as close to 1 second as possible.
2. [10 points] You will configure the timers to generate a periodic 4-Level pulse amplitude
modulated (PAM) signal that takes integer values in the range 0-15. Level 2 and Level 1
are stored as 4MSB and 4LSB, respectively, of the data in location 70H. Level 4 and Level 3
are stored as 4MSB and 4LSB, respectively, of the data in location 71H. The period of the
PAM signal should be 4 s with each level occupying 1 s. The PAM levels have to be written
out on the port pins P3.3-P3.0. These are also to be written on the LCD in the following
format. First row of the LCD should display the level as “Level 1”, “Level 2”, “Level 3”
or “Level 4”. Second row should display the corresponding value as “Value: xxxx”, where
‘xxxx’ is the binary representation.
TA Checkpoints
1. For question 1, ask the students to show the LEDs blinking and check that they use the
Timer.
2. For question 2, place arbitrary 8-bit values in the memory locations 70H and 71H. Check
that the levels and binary values are appropriately displayed on the LCD.

More Related Content

PDF
PDF
PDF
PDF
PDF
PDF
PDF
PDF

What's hot (17)

PDF
PDF
PDF
8051 Interrupts
PDF
PDF
PDF
89c5131datasheet
PDF
Introduction to Microcontrollers
PDF
Serial IO for 8051
PDF
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
PDF
SE PAI Unit 5_IO programming in 8051
PDF
SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3
PDF
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1
PDF
PDF
Pt 51 ver-1.3_user_manual
PPTX
PDF
Intel Hex Format
DOC
Anil 12
8051 Interrupts
89c5131datasheet
Introduction to Microcontrollers
Serial IO for 8051
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_IO programming in 8051
SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1
Pt 51 ver-1.3_user_manual
Intel Hex Format
Anil 12
Ad

Similar to Lab5 s2 (20)

PPTX
6.pptx
PPTX
Counters & time delay
PDF
Advanced insrumentation lab manual
DOCX
Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
PPTX
ppt-U3 - (Programming, Memory Interfacing).pptx
PPT
Microcontroller 8051 introduction
PPTX
UNIT 5.pptx
PDF
Switch Control and Time Delay - Keypad
PDF
Unit 5
PDF
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
PPT
EC203DSD - Module 5 - 3.ppt
PDF
Question Bank microcontroller 8051
PPTX
UNIT 5 Interfacing and Mixed Signal Controller.pptx
PDF
Interfacing with LCD
PPTX
8051 training an interactive tutorial
PPTX
20IT204-COA- Lecture 17.pptx
DOCX
4th sem,(cs is),computer org unit-7
PDF
Real Time Embedded System
PPT
Delay routine
DOCX
Introduction to 8085 & it's description(includes basic lab experiments)
6.pptx
Counters & time delay
Advanced insrumentation lab manual
Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
ppt-U3 - (Programming, Memory Interfacing).pptx
Microcontroller 8051 introduction
UNIT 5.pptx
Switch Control and Time Delay - Keypad
Unit 5
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
EC203DSD - Module 5 - 3.ppt
Question Bank microcontroller 8051
UNIT 5 Interfacing and Mixed Signal Controller.pptx
Interfacing with LCD
8051 training an interactive tutorial
20IT204-COA- Lecture 17.pptx
4th sem,(cs is),computer org unit-7
Real Time Embedded System
Delay routine
Introduction to 8085 & it's description(includes basic lab experiments)
Ad

More from rajbabureliance (8)

PDF
PDF
PDF
PDF
Pt 51 kit - Peripheral self-test
PDF
PDF
PDF
EE337 Course Introduction
PDF
EE337 Course Introduction
Pt 51 kit - Peripheral self-test
EE337 Course Introduction
EE337 Course Introduction

Recently uploaded (20)

PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Lesson notes of climatology university.
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Yogi Goddess Pres Conference Studio Updates
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
01-Introduction-to-Information-Management.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Microbial disease of the cardiovascular and lymphatic systems
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Pharma ospi slides which help in ospi learning
Lesson notes of climatology university.
2.FourierTransform-ShortQuestionswithAnswers.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
O7-L3 Supply Chain Operations - ICLT Program
human mycosis Human fungal infections are called human mycosis..pptx
Yogi Goddess Pres Conference Studio Updates
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
01-Introduction-to-Information-Management.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx

Lab5 s2

  • 1. Lab 5: 20 points EE 337: Microprocessors Laboratory (Spring 2021) Section: S2 (Third year UG) Indian Institute of Technology Bombay Date: Feb 17, 2021 Before attempting this lab, go through the video lectures and notes on interrupts, timers shared in the course Teams page and website. 1. [10 points] You will use the built-in hardware timers in 8051 to generate delays. This is in contrast to the software delay subfunctions you had used in the previous labs. • Write a subroutine that will use a 16-bit number as the count value to program the timer T0 to generate a proportional delay. Recall that the 8051 timers count up. These generate an interrupt (if enabled to do so) when the count wraps around from FFFFH to 0000H. If we want a timer to time-out after N cycles, it should be loaded with −N (i.e., 2’s complement of N). So the subroutine should subtract the 16-bit number from 0000H and load the result as the initial count in T0. While debugging the program with single stepping, you could consider a count value of 1, and load the timer register with -1, so that it overflows at the first increment itself. In actual use, a different count has to be stored. • Write a program that will use the above subroutine to blink the onboard LEDs such that these are ON for one second and OFF for one second continuously. Adjust the timer count and the number of times the delay subroutine is called to make the ON and OFF period as close to 1 second as possible. 2. [10 points] You will configure the timers to generate a periodic 4-Level pulse amplitude modulated (PAM) signal that takes integer values in the range 0-15. Level 2 and Level 1 are stored as 4MSB and 4LSB, respectively, of the data in location 70H. Level 4 and Level 3 are stored as 4MSB and 4LSB, respectively, of the data in location 71H. The period of the PAM signal should be 4 s with each level occupying 1 s. The PAM levels have to be written out on the port pins P3.3-P3.0. These are also to be written on the LCD in the following format. First row of the LCD should display the level as “Level 1”, “Level 2”, “Level 3” or “Level 4”. Second row should display the corresponding value as “Value: xxxx”, where ‘xxxx’ is the binary representation. TA Checkpoints 1. For question 1, ask the students to show the LEDs blinking and check that they use the Timer. 2. For question 2, place arbitrary 8-bit values in the memory locations 70H and 71H. Check that the levels and binary values are appropriately displayed on the LCD.