SlideShare a Scribd company logo
INTERFACING KEYPAD AND DISPLAY THE KEY
PRESSED ON SSD USING 8051
Objectives of the Lab
 Learning how a keypad works
 Learning how to take input using 8051
 Understanding the interfacing of keypad with 8051
 Displaying SSD according to the key pressed on keypad
Deciding Pins or Ports to use
Use with
caution
If EA high
*As keypad is
being used as
input, we can
use any port
except port0.
Let’s use port2
for keypad and
port1 for SSD
Keypad
 Keypads are usually used
for user input.
 The numbers on the top
make them very easy for
a user to be used as an
input for a program.
 It is widely used in
applications that use
MENU to work on.
 There are 7 pins for 3x4
and are 8 pins for 4x4
keypad.
Keypad Internal Circuit
 Whenever a key is
pressed, a certain row
and a column gets short.
 With keypad, we only
need to find out which
row and column is short.
 Then, we only need to
know which key will
make that particular row
and column short.
 We will use this property
of the device to our
advantage.
Keypad with 8051
 We will use a 3x4 keypad, so we will have 7 pins.
 These pin represents 3 columns and 4 rows.
 We need to detect when a key is pressed and which key
is pressed.
 The process of finding the key is done by scanning.
 Scanning ROWs is done by first making rows as input
and giving columns a ground.
 When the key is pressed, we know the row from which
the button is pressed.
 Then, we scan COLs by making cols as input and
giving rows a ground.
 This process happens so fast that still the same key is
pressed and we know the column from which the
button is pressed. Thus we have the corresponding key.
Instructions used in this Lab
 JB Px.y,label
 JNB Px.y,label
 CJNE REG,DATA,LABEL (See instruction set)
 See instruction set for the details of above commands.
Taking input using 8051
 To interface a keypad, we need to learn how to take input.
 There are two formats to take input, one is 1-bit and other
is 8-bit commonly known as single bit input and port
input.
 In both processes, we simply set the pin or port (all pins)
to ‘one’ and then make decisions later in the code.
 e.g. setb p1.0
jb p1.0,$
jmp myfunc
 Also, mov p1,#0FFh
cjne p1,#55,newfunc
jmp exit1
Keypad connections with
8051
 First, we need to define the pins that can
be sorted into the columns and rows.
 We can do that by using DMM; if the
same pin is short when all the keys from
the same column are pressed then this key
is corresponding to column 1.
 After that, we will know which pin is for
which column or row.
 Then, we can assign pins to rows and
columns and write our code.
 Normally the order followed is
C3
P1.0
C2
P1.1
C1
P1.2
R1
P1.6
R2
P1.5
R1
P1.4
R1
P1.3
R1 R2 R3 R4 C1 C2 C3
P1.6,5,4,3,2,1,0
R1 R2 R3 R4 C1 C2 C3
P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0
Algorithm for Keypad and SSD
Display
Start
Scan Rows
main:
mov p2,#0FFh
mov p2,#11111000b
row1:
mov p2,#0FFh
mov p2,#00000111b
jnb p1.2,one
jnb p1.1,two
jnb p1.3,three
jmp main
one: mov p1,#0F9h
jmp main
. . .
jnb p1.6,row1
jnb p1.5,row2
jnb p1.4,row3
jnb p1.3,row4
jmp main
Key from
which
col?
Scan
Cols
Scan
Cols
Scan
Cols
Scan
Cols
row1 row4row2 row3
Key from
which
row?
Digit
Display
0 1 2 3 4
0C0h 0F9h 0A4h 0B0h 099h
5 6 7 8 9
092h 082h 0F8h 080h 098h
Configuration of Keypad available
in Lab
7 1 2 4 3 5 6
R1 R2 R3 R4 C1 C2 C3
P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0
Proteus Devices needed in this Lab
1. AT89c51
2. Keypad
3. 7-seg-CA
Lab Tasks
 Show the digit on SSD corresponding to the key
pressed on Keypad.

More Related Content

What's hot

Subroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerSubroutine in 8051 microcontroller
Subroutine in 8051 microcontroller
bhadresh savani
 
EMBEDDED SYSTEMS 2&3
EMBEDDED SYSTEMS 2&3EMBEDDED SYSTEMS 2&3
EMBEDDED SYSTEMS 2&3PRADEEP
 
Cryptography
CryptographyCryptography
Cryptography
Arpana shree
 
Programming
ProgrammingProgramming
Programmingaescotom
 
Programming
ProgrammingProgramming
Programmingaescotom
 
Lab manual mp
Lab manual mpLab manual mp
Lab manual mp
HarshitParkar6677
 
8051 Microcontroller I/O ports
8051 Microcontroller I/O ports8051 Microcontroller I/O ports
8051 Microcontroller I/O ports
anishgoel
 
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
 
8051 data type and directives
8051 data type and directives8051 data type and directives
8051 data type and directives
SARITHA REDDY
 
Display11 in mp
Display11 in mpDisplay11 in mp
Display11 in mpAisu
 
Microcontroller- An overview
Microcontroller- An overviewMicrocontroller- An overview
Microcontroller- An overview
PANIMALAR ENGINEERING COLLEGE
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Moeez Shem
 

What's hot (13)

Subroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerSubroutine in 8051 microcontroller
Subroutine in 8051 microcontroller
 
EMBEDDED SYSTEMS 2&3
EMBEDDED SYSTEMS 2&3EMBEDDED SYSTEMS 2&3
EMBEDDED SYSTEMS 2&3
 
Cryptography
CryptographyCryptography
Cryptography
 
Programming
ProgrammingProgramming
Programming
 
Programming
ProgrammingProgramming
Programming
 
Lab manual mp
Lab manual mpLab manual mp
Lab manual mp
 
8051 book
8051 book8051 book
8051 book
 
8051 Microcontroller I/O ports
8051 Microcontroller I/O ports8051 Microcontroller I/O ports
8051 Microcontroller I/O ports
 
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...
 
8051 data type and directives
8051 data type and directives8051 data type and directives
8051 data type and directives
 
Display11 in mp
Display11 in mpDisplay11 in mp
Display11 in mp
 
Microcontroller- An overview
Microcontroller- An overviewMicrocontroller- An overview
Microcontroller- An overview
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 

Similar to Micro c lab4(keypad)

Key board interfacing with 8051
Key board interfacing with 8051Key board interfacing with 8051
Key board interfacing with 8051
DominicHendry
 
Input interface with Raspberry pi
Input interface with Raspberry piInput interface with Raspberry pi
Input interface with Raspberry pi
anishgoel
 
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
SANTIAGO PABLO ALBERTO
 
Presentation2 1-150523155048-lva1-app6892
Presentation2 1-150523155048-lva1-app6892Presentation2 1-150523155048-lva1-app6892
Presentation2 1-150523155048-lva1-app6892
Nirav rathod
 
Micro c lab3(ssd)
Micro c lab3(ssd)Micro c lab3(ssd)
Micro c lab3(ssd)
Mashood
 
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
Bharat Biyani
 
PROGRAMMABLE KEYBOARD AND DISPLAY INTERFACE(8279).pptx
PROGRAMMABLE KEYBOARD AND DISPLAY INTERFACE(8279).pptxPROGRAMMABLE KEYBOARD AND DISPLAY INTERFACE(8279).pptx
PROGRAMMABLE KEYBOARD AND DISPLAY INTERFACE(8279).pptx
SanjayV73
 
8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directives
SARITHA REDDY
 
Electronz_Chapter_7.pptx
Electronz_Chapter_7.pptxElectronz_Chapter_7.pptx
Electronz_Chapter_7.pptx
Mokete5
 
8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt
notagain0712
 
08 chapter03 06_status_bits_otl_otu_scan_logic_fa16
08 chapter03 06_status_bits_otl_otu_scan_logic_fa1608 chapter03 06_status_bits_otl_otu_scan_logic_fa16
08 chapter03 06_status_bits_otl_otu_scan_logic_fa16John Todora
 
Micro c lab6(lcd)
Micro c lab6(lcd)Micro c lab6(lcd)
Micro c lab6(lcd)
Mashood
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Rashmi
 
Apple 1 manual & warranty 1976
Apple 1 manual & warranty 1976Apple 1 manual & warranty 1976
Apple 1 manual & warranty 1976
Online Fashion Success
 
Analog to Digital .pptx
Analog to Digital .pptxAnalog to Digital .pptx
Analog to Digital .pptx
karanthakur846894
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
Sadiq Rahim
 
8279 PKDI
8279 PKDI8279 PKDI
8279 PKDI
deval patel
 
Arduino based Applications-part 6
Arduino based Applications-part 6Arduino based Applications-part 6
Arduino based Applications-part 6
Jawaher Abdulwahab Fadhil
 

Similar to Micro c lab4(keypad) (20)

Key board interfacing with 8051
Key board interfacing with 8051Key board interfacing with 8051
Key board interfacing with 8051
 
Input interface with Raspberry pi
Input interface with Raspberry piInput interface with Raspberry pi
Input interface with Raspberry pi
 
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
 
Presentation2 1-150523155048-lva1-app6892
Presentation2 1-150523155048-lva1-app6892Presentation2 1-150523155048-lva1-app6892
Presentation2 1-150523155048-lva1-app6892
 
Micro c lab3(ssd)
Micro c lab3(ssd)Micro c lab3(ssd)
Micro c lab3(ssd)
 
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
 
PROGRAMMABLE KEYBOARD AND DISPLAY INTERFACE(8279).pptx
PROGRAMMABLE KEYBOARD AND DISPLAY INTERFACE(8279).pptxPROGRAMMABLE KEYBOARD AND DISPLAY INTERFACE(8279).pptx
PROGRAMMABLE KEYBOARD AND DISPLAY INTERFACE(8279).pptx
 
8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directives
 
Electronz_Chapter_7.pptx
Electronz_Chapter_7.pptxElectronz_Chapter_7.pptx
Electronz_Chapter_7.pptx
 
8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt
 
08 chapter03 06_status_bits_otl_otu_scan_logic_fa16
08 chapter03 06_status_bits_otl_otu_scan_logic_fa1608 chapter03 06_status_bits_otl_otu_scan_logic_fa16
08 chapter03 06_status_bits_otl_otu_scan_logic_fa16
 
Micro c lab6(lcd)
Micro c lab6(lcd)Micro c lab6(lcd)
Micro c lab6(lcd)
 
Chapt 06
Chapt 06Chapt 06
Chapt 06
 
Chapt 06
Chapt 06Chapt 06
Chapt 06
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Apple 1 manual & warranty 1976
Apple 1 manual & warranty 1976Apple 1 manual & warranty 1976
Apple 1 manual & warranty 1976
 
Analog to Digital .pptx
Analog to Digital .pptxAnalog to Digital .pptx
Analog to Digital .pptx
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
8279 PKDI
8279 PKDI8279 PKDI
8279 PKDI
 
Arduino based Applications-part 6
Arduino based Applications-part 6Arduino based Applications-part 6
Arduino based Applications-part 6
 

More from Mashood

Patience (1).pptx
Patience (1).pptxPatience (1).pptx
Patience (1).pptx
Mashood
 
Micro c lab8(serial communication)
Micro c lab8(serial communication)Micro c lab8(serial communication)
Micro c lab8(serial communication)
Mashood
 
Micro c lab7(timers)
Micro c lab7(timers)Micro c lab7(timers)
Micro c lab7(timers)
Mashood
 
Micro c lab5(stepper-motor)
Micro c lab5(stepper-motor)Micro c lab5(stepper-motor)
Micro c lab5(stepper-motor)
Mashood
 
Micro c lab2(led patterns)
Micro c lab2(led patterns)Micro c lab2(led patterns)
Micro c lab2(led patterns)
Mashood
 
Micro c lab1(intro to 8051)
Micro c lab1(intro to 8051)Micro c lab1(intro to 8051)
Micro c lab1(intro to 8051)
Mashood
 
Amplifiers (analog electronics ii lab)
Amplifiers (analog electronics ii lab)Amplifiers (analog electronics ii lab)
Amplifiers (analog electronics ii lab)
Mashood
 
Pcb design using proteus
Pcb design using proteusPcb design using proteus
Pcb design using proteus
Mashood
 
Function Generator
Function GeneratorFunction Generator
Function Generator
Mashood
 
Speed Measuring Circuit
Speed Measuring CircuitSpeed Measuring Circuit
Speed Measuring Circuit
Mashood
 

More from Mashood (10)

Patience (1).pptx
Patience (1).pptxPatience (1).pptx
Patience (1).pptx
 
Micro c lab8(serial communication)
Micro c lab8(serial communication)Micro c lab8(serial communication)
Micro c lab8(serial communication)
 
Micro c lab7(timers)
Micro c lab7(timers)Micro c lab7(timers)
Micro c lab7(timers)
 
Micro c lab5(stepper-motor)
Micro c lab5(stepper-motor)Micro c lab5(stepper-motor)
Micro c lab5(stepper-motor)
 
Micro c lab2(led patterns)
Micro c lab2(led patterns)Micro c lab2(led patterns)
Micro c lab2(led patterns)
 
Micro c lab1(intro to 8051)
Micro c lab1(intro to 8051)Micro c lab1(intro to 8051)
Micro c lab1(intro to 8051)
 
Amplifiers (analog electronics ii lab)
Amplifiers (analog electronics ii lab)Amplifiers (analog electronics ii lab)
Amplifiers (analog electronics ii lab)
 
Pcb design using proteus
Pcb design using proteusPcb design using proteus
Pcb design using proteus
 
Function Generator
Function GeneratorFunction Generator
Function Generator
 
Speed Measuring Circuit
Speed Measuring CircuitSpeed Measuring Circuit
Speed Measuring Circuit
 

Recently uploaded

A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
christianmathematics
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
ArianaBusciglio
 
Delivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and TrainingDelivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and Training
AG2 Design
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
kitab khulasah nurul yaqin jilid 1 - 2.pptx
kitab khulasah nurul yaqin jilid 1 - 2.pptxkitab khulasah nurul yaqin jilid 1 - 2.pptx
kitab khulasah nurul yaqin jilid 1 - 2.pptx
datarid22
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 

Recently uploaded (20)

A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
 
Delivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and TrainingDelivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and Training
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
kitab khulasah nurul yaqin jilid 1 - 2.pptx
kitab khulasah nurul yaqin jilid 1 - 2.pptxkitab khulasah nurul yaqin jilid 1 - 2.pptx
kitab khulasah nurul yaqin jilid 1 - 2.pptx
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 

Micro c lab4(keypad)

  • 1. INTERFACING KEYPAD AND DISPLAY THE KEY PRESSED ON SSD USING 8051
  • 2. Objectives of the Lab  Learning how a keypad works  Learning how to take input using 8051  Understanding the interfacing of keypad with 8051  Displaying SSD according to the key pressed on keypad
  • 3. Deciding Pins or Ports to use Use with caution If EA high *As keypad is being used as input, we can use any port except port0. Let’s use port2 for keypad and port1 for SSD
  • 4. Keypad  Keypads are usually used for user input.  The numbers on the top make them very easy for a user to be used as an input for a program.  It is widely used in applications that use MENU to work on.  There are 7 pins for 3x4 and are 8 pins for 4x4 keypad.
  • 5. Keypad Internal Circuit  Whenever a key is pressed, a certain row and a column gets short.  With keypad, we only need to find out which row and column is short.  Then, we only need to know which key will make that particular row and column short.  We will use this property of the device to our advantage.
  • 6. Keypad with 8051  We will use a 3x4 keypad, so we will have 7 pins.  These pin represents 3 columns and 4 rows.  We need to detect when a key is pressed and which key is pressed.  The process of finding the key is done by scanning.  Scanning ROWs is done by first making rows as input and giving columns a ground.  When the key is pressed, we know the row from which the button is pressed.  Then, we scan COLs by making cols as input and giving rows a ground.  This process happens so fast that still the same key is pressed and we know the column from which the button is pressed. Thus we have the corresponding key.
  • 7. Instructions used in this Lab  JB Px.y,label  JNB Px.y,label  CJNE REG,DATA,LABEL (See instruction set)  See instruction set for the details of above commands.
  • 8. Taking input using 8051  To interface a keypad, we need to learn how to take input.  There are two formats to take input, one is 1-bit and other is 8-bit commonly known as single bit input and port input.  In both processes, we simply set the pin or port (all pins) to ‘one’ and then make decisions later in the code.  e.g. setb p1.0 jb p1.0,$ jmp myfunc  Also, mov p1,#0FFh cjne p1,#55,newfunc jmp exit1
  • 9. Keypad connections with 8051  First, we need to define the pins that can be sorted into the columns and rows.  We can do that by using DMM; if the same pin is short when all the keys from the same column are pressed then this key is corresponding to column 1.  After that, we will know which pin is for which column or row.  Then, we can assign pins to rows and columns and write our code.  Normally the order followed is C3 P1.0 C2 P1.1 C1 P1.2 R1 P1.6 R2 P1.5 R1 P1.4 R1 P1.3 R1 R2 R3 R4 C1 C2 C3 P1.6,5,4,3,2,1,0 R1 R2 R3 R4 C1 C2 C3 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0
  • 10. Algorithm for Keypad and SSD Display Start Scan Rows main: mov p2,#0FFh mov p2,#11111000b row1: mov p2,#0FFh mov p2,#00000111b jnb p1.2,one jnb p1.1,two jnb p1.3,three jmp main one: mov p1,#0F9h jmp main . . . jnb p1.6,row1 jnb p1.5,row2 jnb p1.4,row3 jnb p1.3,row4 jmp main Key from which col? Scan Cols Scan Cols Scan Cols Scan Cols row1 row4row2 row3 Key from which row? Digit Display 0 1 2 3 4 0C0h 0F9h 0A4h 0B0h 099h 5 6 7 8 9 092h 082h 0F8h 080h 098h
  • 11. Configuration of Keypad available in Lab 7 1 2 4 3 5 6 R1 R2 R3 R4 C1 C2 C3 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0
  • 12. Proteus Devices needed in this Lab 1. AT89c51 2. Keypad 3. 7-seg-CA
  • 13. Lab Tasks  Show the digit on SSD corresponding to the key pressed on Keypad.