SlideShare a Scribd company logo
1 of 1
Download to read offline
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

What's hot (17)

Lab7 s1
Lab7 s1Lab7 s1
Lab7 s1
 
Lab3 s1
Lab3 s1Lab3 s1
Lab3 s1
 
8051 Interrupts
8051 Interrupts8051 Interrupts
8051 Interrupts
 
8051 Timers
8051 Timers8051 Timers
8051 Timers
 
Lab7 s2
Lab7 s2Lab7 s2
Lab7 s2
 
89c5131datasheet
89c5131datasheet89c5131datasheet
89c5131datasheet
 
Introduction to Microcontrollers
Introduction to MicrocontrollersIntroduction to Microcontrollers
Introduction to Microcontrollers
 
Serial IO for 8051
Serial IO for 8051Serial IO for 8051
Serial IO for 8051
 
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
 
SE PAI Unit 5_IO programming in 8051
SE PAI Unit 5_IO programming in 8051SE PAI Unit 5_IO programming in 8051
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_Serial Port Programming in 8051 micro controller_Part 3SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3
SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3
 
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1
 
Lab5 s1
Lab5 s1Lab5 s1
Lab5 s1
 
Pt 51 ver-1.3_user_manual
Pt 51 ver-1.3_user_manualPt 51 ver-1.3_user_manual
Pt 51 ver-1.3_user_manual
 
Jp
Jp Jp
Jp
 
Intel Hex Format
Intel Hex FormatIntel Hex Format
Intel Hex Format
 
Anil 12
Anil 12Anil 12
Anil 12
 

Similar to Lab5 s2

Counters & time delay
Counters & time delayCounters & time delay
Counters & time delayHemant Chetwani
 
Advanced insrumentation lab manual
Advanced insrumentation lab manualAdvanced insrumentation lab manual
Advanced insrumentation lab manualGautam sai teza
 
Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
Customizable Microprocessor design on Nexys 3 Spartan FPGA BoardCustomizable Microprocessor design on Nexys 3 Spartan FPGA Board
Customizable Microprocessor design on Nexys 3 Spartan FPGA BoardBharat Biyani
 
ppt-U3 - (Programming, Memory Interfacing).pptx
ppt-U3 - (Programming, Memory Interfacing).pptxppt-U3 - (Programming, Memory Interfacing).pptx
ppt-U3 - (Programming, Memory Interfacing).pptxRaviKiranVarma4
 
Microcontroller 8051 introduction
Microcontroller 8051 introductionMicrocontroller 8051 introduction
Microcontroller 8051 introductionEngr umar
 
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Sivaranjan Goswami
 
UNIT 5 Interfacing and Mixed Signal Controller.pptx
UNIT 5 Interfacing and Mixed Signal Controller.pptxUNIT 5 Interfacing and Mixed Signal Controller.pptx
UNIT 5 Interfacing and Mixed Signal Controller.pptxGowrishankar C
 
8051 training an interactive tutorial
8051 training an interactive tutorial8051 training an interactive tutorial
8051 training an interactive tutorialFutura infotech
 
20IT204-COA- Lecture 17.pptx
20IT204-COA- Lecture 17.pptx20IT204-COA- Lecture 17.pptx
20IT204-COA- Lecture 17.pptxPerumalPitchandi
 
4th sem,(cs is),computer org unit-7
4th sem,(cs is),computer org unit-74th sem,(cs is),computer org unit-7
4th sem,(cs is),computer org unit-7Sujay pai
 
Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Basil John
 

Similar to Lab5 s2 (20)

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

More from rajbabureliance

More from rajbabureliance (8)

Lab7 s1
Lab7 s1Lab7 s1
Lab7 s1
 
Lab7 s1
Lab7 s1Lab7 s1
Lab7 s1
 
Lab3 s2
Lab3 s2Lab3 s2
Lab3 s2
 
Pt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-testPt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-test
 
Lab2 s1
Lab2 s1Lab2 s1
Lab2 s1
 
Lab2 s2
Lab2 s2Lab2 s2
Lab2 s2
 
EE337 Course Introduction
EE337 Course IntroductionEE337 Course Introduction
EE337 Course Introduction
 
EE337 Course Introduction
EE337 Course IntroductionEE337 Course Introduction
EE337 Course Introduction
 

Recently uploaded

MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 

Recently uploaded (20)

MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 

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.