SlideShare a Scribd company logo
Lab 6: 20 points
EE 337: Microprocessors Laboratory (Spring 2021)
Section: S2 (Third year UG)
Indian Institute of Technology Bombay
Date: March 10, 2021
1. [10 points] Write code to implement a simple reaction timer that works as follows and uses
interrupts.
i) Set the switch SW1 in Off position. The program starts with a message on LCD as
“Toggle SW1” on the first line and “when LED glows” on the second line. After
displaying this message for 2 seconds, turn on the LED P1.4.
ii) The user toggles SW1 because of the displayed message. The LED should be turned
Off as soon as the switch is toggled.
iii) The program is expected to measure time between the instant the LED starts glowing
and the instant the switch toggle is identified.
iv) Next, the display on the LCD shows “Reaction Time” on the first line and the “Count
is XX XXXX” on the second line. Assuming T0 is used, display of count should be
of 6 digits. First 2 digits show the number of times the timer has overflown, next 2
digits show the TH0 value, next 2 digits show TL0 value, each value in hexadecimal.
This message is displayed for 5 seconds. Note: Optionally, you can display the time
in msec.
v) Go back to Step (i) and repeat the process continuously.
2. [10 points] Write code to generate two musical notes corresponding to the frequencies shown
in Table 1. The musical notes can be generated as square waveform of specific frequencies.
These can be generated and output using the speaker with appropriate interfacing.
1. Use timer T0 to generate the note (waveform) of appropriate frequency. Use timer
T1 to control the duration of the note. The output has to be written to port P0.0.
Generate the two notes shown in Table 1 and let the duration of the notes be 2 s each.
Do this continuously and verify the output using the debugger.
2. Connect the speaker to the Pt-51 kit using the SL100 transistor and interfacing circuit
shown in Figure 1. You should be able to hear the notes being played out on the
speaker.
Table 1: Note frequencies.
S. No. Note Frequency
1 Sa 240
2 Re 270
TA Checkpoints
1. For question 1, ask the students to show the working of the reaction timer. Do this with
short and long reaction times.
2. For question 2, check the appropriate waveforms on the logic analyzer (Keil). Also ask
them to play out the notes.
(a) SL100 pinout
+5V
SPEAKER
C
B
E
470 ohms
1K ohms
High Volume
Low Volume
Audio Signal from Board
RED
BLACK
SL/CL 100
(b) Speaker driver circuit.
Figure 1: Circuit for interfacing Pt-51 with speaker.

More Related Content

PDF
PDF
PDF
PDF
PDF
PDF
PDF
PDF
Pt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-test

What's hot (20)

PDF
DOCX
Digital clock
PPTX
Digital clock (mod counters)using DSCH (DIGITAL SCHEMATIC) by Gaurav Raikar
DOCX
8051 FINIAL
PPT
Csa ic
PDF
Digital Alarm Clock 446 project report
PPT
Physical prototyping lab1-input_output (2)
PPTX
Mod 10 synchronous counter updated
PDF
Using Timers in PIC18F Microcontrollers
PDF
Chapter 5 counter
PPT
Ee2 chapter14 ic_counters
PPT
Physical prototyping lab3-serious_serial
PPSX
Node finder presentation
PDF
Certifying (RISC) Machine Code Safe from Aliasing (OpenCert 2013)
DOCX
Digital Alarm Clock (IC-TMS-8560)
PPTX
digital Counter
PPTX
Counters
PDF
Counters
PPT
Ece221 Ch7 Part1
PPT
Physical prototyping lab2-analog_digital
Digital clock
Digital clock (mod counters)using DSCH (DIGITAL SCHEMATIC) by Gaurav Raikar
8051 FINIAL
Csa ic
Digital Alarm Clock 446 project report
Physical prototyping lab1-input_output (2)
Mod 10 synchronous counter updated
Using Timers in PIC18F Microcontrollers
Chapter 5 counter
Ee2 chapter14 ic_counters
Physical prototyping lab3-serious_serial
Node finder presentation
Certifying (RISC) Machine Code Safe from Aliasing (OpenCert 2013)
Digital Alarm Clock (IC-TMS-8560)
digital Counter
Counters
Counters
Ece221 Ch7 Part1
Physical prototyping lab2-analog_digital
Ad

Similar to Lab6 s2 (20)

PDF
PDF
PDF
EE337 Microprocessors Lab Labsheet 5
PDF
PDF
8051 Timers and Counters
PDF
PDF
PPT
4.Timer_1.ppt
PPTX
PPTX
Embedded Systems Lab Practical PowerPoint presentation with source code
PDF
PDF
Frequency Spectrum Displayer
PDF
Vlsi model question paper 2 (june 2021)
PPTX
Timer programming
PPTX
Timer ppt
PPTX
MoD 4 Counters TermWork1MOD4Counter.pptx
PPTX
hdl timer ppt.pptx
PPT
8051 Timer
PDF
Laboratory exercise 5
PPTX
Micro c lab7(timers)
EE337 Microprocessors Lab Labsheet 5
8051 Timers and Counters
4.Timer_1.ppt
Embedded Systems Lab Practical PowerPoint presentation with source code
Frequency Spectrum Displayer
Vlsi model question paper 2 (june 2021)
Timer programming
Timer ppt
MoD 4 Counters TermWork1MOD4Counter.pptx
hdl timer ppt.pptx
8051 Timer
Laboratory exercise 5
Micro c lab7(timers)
Ad

More from rajbabureliance (6)

PDF
PDF
PDF
PDF
PDF
EE337 Course Introduction
PDF
EE337 Course Introduction
EE337 Course Introduction
EE337 Course Introduction

Recently uploaded (20)

PPTX
TNA_Presentation-1-Final(SAVE)) (1).pptx
PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
advance database management system book.pdf
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Introduction to Building Materials
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
AI-driven educational solutions for real-life interventions in the Philippine...
PDF
HVAC Specification 2024 according to central public works department
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
Indian roads congress 037 - 2012 Flexible pavement
PDF
Computing-Curriculum for Schools in Ghana
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
TNA_Presentation-1-Final(SAVE)) (1).pptx
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
advance database management system book.pdf
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
Introduction to pro and eukaryotes and differences.pptx
Chinmaya Tiranga quiz Grand Finale.pdf
Introduction to Building Materials
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
Paper A Mock Exam 9_ Attempt review.pdf.
LDMMIA Reiki Yoga Finals Review Spring Summer
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
202450812 BayCHI UCSC-SV 20250812 v17.pptx
AI-driven educational solutions for real-life interventions in the Philippine...
HVAC Specification 2024 according to central public works department
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
Indian roads congress 037 - 2012 Flexible pavement
Computing-Curriculum for Schools in Ghana
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)

Lab6 s2

  • 1. Lab 6: 20 points EE 337: Microprocessors Laboratory (Spring 2021) Section: S2 (Third year UG) Indian Institute of Technology Bombay Date: March 10, 2021 1. [10 points] Write code to implement a simple reaction timer that works as follows and uses interrupts. i) Set the switch SW1 in Off position. The program starts with a message on LCD as “Toggle SW1” on the first line and “when LED glows” on the second line. After displaying this message for 2 seconds, turn on the LED P1.4. ii) The user toggles SW1 because of the displayed message. The LED should be turned Off as soon as the switch is toggled. iii) The program is expected to measure time between the instant the LED starts glowing and the instant the switch toggle is identified. iv) Next, the display on the LCD shows “Reaction Time” on the first line and the “Count is XX XXXX” on the second line. Assuming T0 is used, display of count should be of 6 digits. First 2 digits show the number of times the timer has overflown, next 2 digits show the TH0 value, next 2 digits show TL0 value, each value in hexadecimal. This message is displayed for 5 seconds. Note: Optionally, you can display the time in msec. v) Go back to Step (i) and repeat the process continuously. 2. [10 points] Write code to generate two musical notes corresponding to the frequencies shown in Table 1. The musical notes can be generated as square waveform of specific frequencies. These can be generated and output using the speaker with appropriate interfacing. 1. Use timer T0 to generate the note (waveform) of appropriate frequency. Use timer T1 to control the duration of the note. The output has to be written to port P0.0. Generate the two notes shown in Table 1 and let the duration of the notes be 2 s each. Do this continuously and verify the output using the debugger. 2. Connect the speaker to the Pt-51 kit using the SL100 transistor and interfacing circuit shown in Figure 1. You should be able to hear the notes being played out on the speaker. Table 1: Note frequencies. S. No. Note Frequency 1 Sa 240 2 Re 270 TA Checkpoints 1. For question 1, ask the students to show the working of the reaction timer. Do this with short and long reaction times. 2. For question 2, check the appropriate waveforms on the logic analyzer (Keil). Also ask them to play out the notes.
  • 2. (a) SL100 pinout +5V SPEAKER C B E 470 ohms 1K ohms High Volume Low Volume Audio Signal from Board RED BLACK SL/CL 100 (b) Speaker driver circuit. Figure 1: Circuit for interfacing Pt-51 with speaker.