SlideShare ist ein Scribd-Unternehmen logo
1 von 2
Downloaden Sie, um offline zu lesen
Lab 6: 20 points
EE 337: Microprocessors Laboratory (Spring 2023)
Indian Institute of Technology Bombay
Date: February 13, 2023
1. [5 points] In this experiment, you will learn to display content on the LCD connected
to the Pt-51 kit. Download lcd.h, lcd.c files and lcd-control-made-easy.pdf
from the following links.
• https://ee337.github.io/2023/downloads/lcd.h
• https://ee337.github.io/2023/downloads/lcd.c
• https://ee337.github.io/2023/downloads/lcd-control-made-easy.pdf
The lcd-control-made-easy.pdf has general information about LCD operation
which is helpful in understanding the code in lcd.h. Also, lcd.h has comments for
each line, try to understand the comments by going through the code line by line.
• Compile lcd.c with header file lcd.h and load the hex file on to the kit. Make
sure the output on the LCD screen is as shown below:
Pt-51
IIT Bombay
• Study the functions used in the lcd.h code and their usage. Modify lcd.c to
display “EE337-2023” on the first line and your first name on the second line
(truncate to 16 characters if you have a longer name). Pad the display lines
with spaces such that these are centered on the LCD when displayed.
You should load and run this program on the Pt-51 kit.
2. [15 points] Write a program in Embedded C to read five numbers of 4-bit each, sort
these numbers in ascending order and display the numbers in the sorted order. Then
follow the below steps. For generating the given delays improvise and use msdelay
function given in lcd.h file which generates 1 ms delay.
• At the start, display ”START PROGRAM” on the first row of LCD screen
for 5 seconds and keep all LEDs OFF.
• While taking the first input, display ”FIRST INPUT” on the first row of
LCD screen for 5 seconds.
• Read the first input number from port 1 (P1.3-P1.0) DIP switches and display
it on the LEDs connected to port 1 (P1.4 to P1.7) for 5 seconds. Also, store the
first input number in an array.
• While the first input is being displayed on LED, give the second input number
using DIP switches and display ”NEXT INPUT” on the LCD.
• After the the first input is displayed for 5 seconds, pause for 1 second keeping
all LEDs off.
• Display the second input number on the LEDs for 5 seconds and continue to
display ”NEXT INPUT” on the LCD. Also, store the second input number
in the same array. Give the next input through DIP switches during this time.
• Repeat the above process for the next three numbers as well and place each of
them in the array.
• While the last input is being displayed on the LEDs for 5 seconds, display
”SORTING...” on the LCD.
• After the last input is displayed, pause for 1 second keeping all LEDs off and
display ”SORTING” in the first row, ”COMPLETED” in the second row.
• Sort the five numbers in ascending order and display it on LEDs, each for 5
seconds with a pause of 1 second with all LEDs off.
• After displaying the sorted array, give a pause of 1 second with all LEDs off.
Then turn on all the LEDs for 5 seconds where you have to take the in-
put to be searched and display ”NUMBER TO BE” in the first row and
”SEARCHED” in the second row of the LCD.
• Give a pause of 1 second by clearing both LEDs and LCD.
• Perform any search algorithm on the sorted array of five numbers.
• If the number is present in the array, display the index at which the number
is present (assume array index starts from 1) on the LEDs and display ”THE
INDEX IS” on LCD.
• If the number is absent, ON all the LEDs and display ”NUMBER” in the first
row and ”NOT FOUND” in the second row of the LCD.
TA Checkpoints
• Check the understanding of LCD operation and the lcd.c code.
• For question 1, check that the text is properly centered.
• For question 2, check the working of the experiment using the following test cases.
1. Input array = {8, 2, 15, 12, 4}
Item to be searched = 2
2. Input array = {7, 6, 13, 9, 11}
Item to be searched = 14

Weitere ähnliche Inhalte

Ähnlich wie EE337 Labsheet 6

Design pipeline architecture for various stage pipelines
Design pipeline architecture for various stage pipelinesDesign pipeline architecture for various stage pipelines
Design pipeline architecture for various stage pipelinesMahmudul Hasan
 
ECET 340 Effective Communication/tutorialrank.com
 ECET 340 Effective Communication/tutorialrank.com ECET 340 Effective Communication/tutorialrank.com
ECET 340 Effective Communication/tutorialrank.comjonhson203
 
For this phase of the course project, you will research a bank to .docx
For this phase of the course project, you will research a bank to .docxFor this phase of the course project, you will research a bank to .docx
For this phase of the course project, you will research a bank to .docxhanneloremccaffery
 
Ecet 340 Teaching Effectively--tutorialrank.com
Ecet 340 Teaching Effectively--tutorialrank.comEcet 340 Teaching Effectively--tutorialrank.com
Ecet 340 Teaching Effectively--tutorialrank.comSoaps97
 
Full Cycle Testing for Embedded Systems
Full Cycle Testing for Embedded SystemsFull Cycle Testing for Embedded Systems
Full Cycle Testing for Embedded SystemsGlobalLogic Ukraine
 
Dot matrix display design using fpga
Dot matrix display design using fpgaDot matrix display design using fpga
Dot matrix display design using fpgaHossam Hassan
 
Automationcontrol6
Automationcontrol6Automationcontrol6
Automationcontrol6liyanagek
 
Swinburne University of Technology Faculty of Science, E.docx
Swinburne University of Technology Faculty of Science, E.docxSwinburne University of Technology Faculty of Science, E.docx
Swinburne University of Technology Faculty of Science, E.docxmattinsonjanel
 
ECE 323 Final Project Report
ECE 323 Final Project ReportECE 323 Final Project Report
ECE 323 Final Project ReportJonathan Lepp
 
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
 
Ecet 105 Education Specialist -snaptutorial.com
Ecet 105   Education Specialist -snaptutorial.comEcet 105   Education Specialist -snaptutorial.com
Ecet 105 Education Specialist -snaptutorial.comDavisMurphyC39
 
Display a Character on a 7 Segment Display
Display a Character on a 7 Segment DisplayDisplay a Character on a 7 Segment Display
Display a Character on a 7 Segment DisplayRihab Rahman
 
239587360 ee200-lab-manual
239587360 ee200-lab-manual239587360 ee200-lab-manual
239587360 ee200-lab-manualhomeworkping4
 
Cis 115 Education Redefined-snaptutorial.com
Cis 115 Education Redefined-snaptutorial.comCis 115 Education Redefined-snaptutorial.com
Cis 115 Education Redefined-snaptutorial.comrobertledwes38
 
Microcontroladores: El microcontrolador 8051 con LCD 16x2
Microcontroladores: El microcontrolador 8051 con LCD 16x2Microcontroladores: El microcontrolador 8051 con LCD 16x2
Microcontroladores: El microcontrolador 8051 con LCD 16x2SANTIAGO PABLO ALBERTO
 

Ähnlich wie EE337 Labsheet 6 (20)

Design pipeline architecture for various stage pipelines
Design pipeline architecture for various stage pipelinesDesign pipeline architecture for various stage pipelines
Design pipeline architecture for various stage pipelines
 
Lab3 s2
Lab3 s2Lab3 s2
Lab3 s2
 
ECET 340 Effective Communication/tutorialrank.com
 ECET 340 Effective Communication/tutorialrank.com ECET 340 Effective Communication/tutorialrank.com
ECET 340 Effective Communication/tutorialrank.com
 
For this phase of the course project, you will research a bank to .docx
For this phase of the course project, you will research a bank to .docxFor this phase of the course project, you will research a bank to .docx
For this phase of the course project, you will research a bank to .docx
 
Ecet 340 Teaching Effectively--tutorialrank.com
Ecet 340 Teaching Effectively--tutorialrank.comEcet 340 Teaching Effectively--tutorialrank.com
Ecet 340 Teaching Effectively--tutorialrank.com
 
Full Cycle Testing for Embedded Systems
Full Cycle Testing for Embedded SystemsFull Cycle Testing for Embedded Systems
Full Cycle Testing for Embedded Systems
 
Dot matrix display design using fpga
Dot matrix display design using fpgaDot matrix display design using fpga
Dot matrix display design using fpga
 
Introduction to Microcontrollers
Introduction to MicrocontrollersIntroduction to Microcontrollers
Introduction to Microcontrollers
 
EE337 Spring 2023 Lab1
EE337 Spring 2023 Lab1EE337 Spring 2023 Lab1
EE337 Spring 2023 Lab1
 
Switch Control and Time Delay - Keypad
Switch Control and Time Delay - KeypadSwitch Control and Time Delay - Keypad
Switch Control and Time Delay - Keypad
 
Automationcontrol6
Automationcontrol6Automationcontrol6
Automationcontrol6
 
Swinburne University of Technology Faculty of Science, E.docx
Swinburne University of Technology Faculty of Science, E.docxSwinburne University of Technology Faculty of Science, E.docx
Swinburne University of Technology Faculty of Science, E.docx
 
ECE 323 Final Project Report
ECE 323 Final Project ReportECE 323 Final Project Report
ECE 323 Final Project Report
 
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
 
Ecet 105 Education Specialist -snaptutorial.com
Ecet 105   Education Specialist -snaptutorial.comEcet 105   Education Specialist -snaptutorial.com
Ecet 105 Education Specialist -snaptutorial.com
 
Display a Character on a 7 Segment Display
Display a Character on a 7 Segment DisplayDisplay a Character on a 7 Segment Display
Display a Character on a 7 Segment Display
 
239587360 ee200-lab-manual
239587360 ee200-lab-manual239587360 ee200-lab-manual
239587360 ee200-lab-manual
 
Lab5 s2
Lab5 s2Lab5 s2
Lab5 s2
 
Cis 115 Education Redefined-snaptutorial.com
Cis 115 Education Redefined-snaptutorial.comCis 115 Education Redefined-snaptutorial.com
Cis 115 Education Redefined-snaptutorial.com
 
Microcontroladores: El microcontrolador 8051 con LCD 16x2
Microcontroladores: El microcontrolador 8051 con LCD 16x2Microcontroladores: El microcontrolador 8051 con LCD 16x2
Microcontroladores: El microcontrolador 8051 con LCD 16x2
 

Mehr von SaravananVijayakumar4

EE337 Microprocessors Lab Labsheet 5
EE337 Microprocessors Lab Labsheet 5EE337 Microprocessors Lab Labsheet 5
EE337 Microprocessors Lab Labsheet 5SaravananVijayakumar4
 
EE337 Microprocessor Lab, Course Outline, Spring 2023
EE337 Microprocessor Lab, Course Outline, Spring 2023EE337 Microprocessor Lab, Course Outline, Spring 2023
EE337 Microprocessor Lab, Course Outline, Spring 2023SaravananVijayakumar4
 
EE 337 Lab 1 for Section 1 (2nd year UG)
 EE 337 Lab 1 for Section 1 (2nd year UG) EE 337 Lab 1 for Section 1 (2nd year UG)
EE 337 Lab 1 for Section 1 (2nd year UG)SaravananVijayakumar4
 
EE 337 Lab 1 for Section 2 (3rd year UG)
EE 337 Lab 1 for Section 2 (3rd year UG)EE 337 Lab 1 for Section 2 (3rd year UG)
EE 337 Lab 1 for Section 2 (3rd year UG)SaravananVijayakumar4
 
Getting started with Keil uVision 2020
Getting started with Keil uVision 2020Getting started with Keil uVision 2020
Getting started with Keil uVision 2020SaravananVijayakumar4
 
Hex file creation using Keil uVision
Hex file creation using Keil uVisionHex file creation using Keil uVision
Hex file creation using Keil uVisionSaravananVijayakumar4
 
Debugging programs with Keil uVision
Debugging programs with Keil uVisionDebugging programs with Keil uVision
Debugging programs with Keil uVisionSaravananVijayakumar4
 

Mehr von SaravananVijayakumar4 (19)

EE337 Microprocessors Lab Labsheet 5
EE337 Microprocessors Lab Labsheet 5EE337 Microprocessors Lab Labsheet 5
EE337 Microprocessors Lab Labsheet 5
 
EE337 Microprocessor Lab, Course Outline, Spring 2023
EE337 Microprocessor Lab, Course Outline, Spring 2023EE337 Microprocessor Lab, Course Outline, Spring 2023
EE337 Microprocessor Lab, Course Outline, Spring 2023
 
EE337 Course introduction 2021
EE337 Course introduction 2021EE337 Course introduction 2021
EE337 Course introduction 2021
 
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
 
EE 337 Lab 1 for Section 1 (2nd year UG)
 EE 337 Lab 1 for Section 1 (2nd year UG) EE 337 Lab 1 for Section 1 (2nd year UG)
EE 337 Lab 1 for Section 1 (2nd year UG)
 
Intel Hex Format
Intel Hex FormatIntel Hex Format
Intel Hex Format
 
EE 337 Lab 1 for Section 2 (3rd year UG)
EE 337 Lab 1 for Section 2 (3rd year UG)EE 337 Lab 1 for Section 2 (3rd year UG)
EE 337 Lab 1 for Section 2 (3rd year UG)
 
Getting started with Keil uVision 2020
Getting started with Keil uVision 2020Getting started with Keil uVision 2020
Getting started with Keil uVision 2020
 
EE337 Course introduction 2021
EE337 Course introduction 2021EE337 Course introduction 2021
EE337 Course introduction 2021
 
Hex file creation using Keil uVision
Hex file creation using Keil uVisionHex file creation using Keil uVision
Hex file creation using Keil uVision
 
Debugging programs with Keil uVision
Debugging programs with Keil uVisionDebugging programs with Keil uVision
Debugging programs with Keil uVision
 
Serial IO for 8051
Serial IO for 8051Serial IO for 8051
Serial IO for 8051
 
8051 Timers
8051 Timers8051 Timers
8051 Timers
 
8051 Interrupts
8051 Interrupts8051 Interrupts
8051 Interrupts
 
Introduction to Microcontrollers
Introduction to MicrocontrollersIntroduction to Microcontrollers
Introduction to Microcontrollers
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
89c5131datasheet
89c5131datasheet89c5131datasheet
89c5131datasheet
 
Pt-51 User Manual
Pt-51 User ManualPt-51 User Manual
Pt-51 User Manual
 
EE337 Course introduction 2018
EE337 Course introduction 2018EE337 Course introduction 2018
EE337 Course introduction 2018
 

Kürzlich hochgeladen

Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Kürzlich hochgeladen (20)

Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

EE337 Labsheet 6

  • 1. Lab 6: 20 points EE 337: Microprocessors Laboratory (Spring 2023) Indian Institute of Technology Bombay Date: February 13, 2023 1. [5 points] In this experiment, you will learn to display content on the LCD connected to the Pt-51 kit. Download lcd.h, lcd.c files and lcd-control-made-easy.pdf from the following links. • https://ee337.github.io/2023/downloads/lcd.h • https://ee337.github.io/2023/downloads/lcd.c • https://ee337.github.io/2023/downloads/lcd-control-made-easy.pdf The lcd-control-made-easy.pdf has general information about LCD operation which is helpful in understanding the code in lcd.h. Also, lcd.h has comments for each line, try to understand the comments by going through the code line by line. • Compile lcd.c with header file lcd.h and load the hex file on to the kit. Make sure the output on the LCD screen is as shown below: Pt-51 IIT Bombay • Study the functions used in the lcd.h code and their usage. Modify lcd.c to display “EE337-2023” on the first line and your first name on the second line (truncate to 16 characters if you have a longer name). Pad the display lines with spaces such that these are centered on the LCD when displayed. You should load and run this program on the Pt-51 kit. 2. [15 points] Write a program in Embedded C to read five numbers of 4-bit each, sort these numbers in ascending order and display the numbers in the sorted order. Then follow the below steps. For generating the given delays improvise and use msdelay function given in lcd.h file which generates 1 ms delay. • At the start, display ”START PROGRAM” on the first row of LCD screen for 5 seconds and keep all LEDs OFF. • While taking the first input, display ”FIRST INPUT” on the first row of LCD screen for 5 seconds. • Read the first input number from port 1 (P1.3-P1.0) DIP switches and display it on the LEDs connected to port 1 (P1.4 to P1.7) for 5 seconds. Also, store the first input number in an array. • While the first input is being displayed on LED, give the second input number using DIP switches and display ”NEXT INPUT” on the LCD. • After the the first input is displayed for 5 seconds, pause for 1 second keeping all LEDs off. • Display the second input number on the LEDs for 5 seconds and continue to display ”NEXT INPUT” on the LCD. Also, store the second input number in the same array. Give the next input through DIP switches during this time. • Repeat the above process for the next three numbers as well and place each of them in the array. • While the last input is being displayed on the LEDs for 5 seconds, display ”SORTING...” on the LCD.
  • 2. • After the last input is displayed, pause for 1 second keeping all LEDs off and display ”SORTING” in the first row, ”COMPLETED” in the second row. • Sort the five numbers in ascending order and display it on LEDs, each for 5 seconds with a pause of 1 second with all LEDs off. • After displaying the sorted array, give a pause of 1 second with all LEDs off. Then turn on all the LEDs for 5 seconds where you have to take the in- put to be searched and display ”NUMBER TO BE” in the first row and ”SEARCHED” in the second row of the LCD. • Give a pause of 1 second by clearing both LEDs and LCD. • Perform any search algorithm on the sorted array of five numbers. • If the number is present in the array, display the index at which the number is present (assume array index starts from 1) on the LEDs and display ”THE INDEX IS” on LCD. • If the number is absent, ON all the LEDs and display ”NUMBER” in the first row and ”NOT FOUND” in the second row of the LCD. TA Checkpoints • Check the understanding of LCD operation and the lcd.c code. • For question 1, check that the text is properly centered. • For question 2, check the working of the experiment using the following test cases. 1. Input array = {8, 2, 15, 12, 4} Item to be searched = 2 2. Input array = {7, 6, 13, 9, 11} Item to be searched = 14