SlideShare una empresa de Scribd logo
1 de 10
Descargar para leer sin conexión
CENTRE OF DIPLOMA STUDIES



COMPUTER ADDED DESIGN LABORATORY



   LABORATORY INSTRUCTION SHEET



                        DEK 3133
Subject Code and Name
                        MICROCONTROLLER

  Experiment Code       04

                        Introduction to Keypad and LCD
   Experiment Title     program

    Course Code         DET/DEE/DEX
Document Reference
                       No.                         RPP-05                 Page. Number               Page |1
                                                                          Edition                      1
                                                     LABORATORY           Revision No.                    4
                            Document Title
                                                      PRACTICUM           Effective Date              03/8/2010
                                                                          Amendment Date              03/8/2010

                                         SUBJECT INFORMATION

SUBJECT         : DEK 3133 MICROCONTROLLER

TOPIC           : Lab 4 – Introduction to Keypad and LCD program.

AIM             To apply the knowledge and understanding on theory and applications of keypad.



1     OBJECTIVES

1.1   To understand the design of keypad.

1.2   To determine and analyze the function of keypad.

1.3   To understand the configuration of LCD.

2     EQUIPMENT

2.1   PIC Development Board – PICDEV

2.2   PIC16F877A

2.3   MPLAB IDE Program

2.4   Mikro C

2.5   Proteus

2.6   The PIC Development Board User manual

2.7   Power supply 9V


3     THEORY

3.1 KEYPAD SYSTEM
Keypads are an excellent way of entering data into the microcontroller. The keys are usually numbered but
they could be labeled as function keys, for example in a remote control handset in a TV to adjust the sound or
color, etc.

    As well as remote controls, keypads find applications in burglar alarms, door entry system, calculators,
microwave ovens, etc. Keypads are usually arranged in a matrix format to reduce the number of I/O
connections. A 12 keypad is arranged in a 3 x 4 format requiring seven connections.
Document Reference
                       No.                        RPP-05                  Page. Number               Page |2
                                                                          Edition                      1
                                                     LABORATORY           Revision No.                    4
                            Document Title
                                                      PRACTICUM           Effective Date             03/8/2010
                                                                          Amendment Date             03/8/2010

     This is arranged in three columns and four rows as shown in Table 1. There are seven connections to
the keypad – C1, C2, C3, R1, R2, R3 and R4.

                                      Column1,C1          Column2,C2           Coulmn3,C3

         Row1, R1                            1                  2                    3

         Row2, R2                            4                  5                    6

         Row3, R3                            7                  8                    9

         Row4, R4                            *                  0                    #

                                                   Table 1



This connection to PIC is shown in Figure 1. The keypad works in the following way:

If, for example, key 6 is pressed then A3 will be joined to B5. For key 1, A1 would be joined to B4, etc. as
shown in Figure 1.

             Port A [1:3] = output       Port B [0:3] = output and Port B [4:7] = input

                                                       RA1
                                                       RA2          RB0
                                                       RA3
                                                                    RB1

                                                                    RB2
                                                                    RB3
               1      2      3         Row1            RB4

               4      5      6         Row2            RB5

               7      8      9         Row3            RB6

               *      0      #         Row4            RB7


                                                   Figure 1

The figure 1 above show the 4x3 keypad size which is 3 columns and 4 rows. To tell the PIC which button is
pressed, the PIC need to set only one of the column to be high at one time. Then the PIC will scan which row is
Document Reference
                        No.                         RPP-05                  Page. Number                Page |3
                                                                            Edition                       1
                                                      LABORATORY            Revision No.                     4
                            Document Title
                                                       PRACTICUM            Effective Date              03/8/2010
                                                                            Amendment Date              03/8/2010

at current column send the HIGH value (1) to the PIC input at PORTB. For example, Let say the PIC need to
recognize the buttons at column 1 which the available button are 1, 4, 7 and *. So the PIC will send the
PORTA.F1 (COLUMN 1) to HIGH (1). Then the PIC will scan each row of PORTB begin from PORTB.F4
(ROW 1). At this stage, if the scanned result is HIGH that means the pressed button is equal to 1. If the result is
LOW (0), then the PIC will continue to scan for the next row(ROW2, ROW3, and ROW4). When all rows at
PORTB are scanned, the PIC will send the HIGH (1) value to the next column (COLUMN 2 at PORTA.F2)
and repeat to scan each row of port B. This process is repeated to all columns. When the last column
(COLUMN3: PORTA.F3) is reached, PIC will scan again for all rows at column1, 2 and so on.

The value need to submit to the columns and read the rows value are actually can be vary. It depends on how
the keypad is designed.



3.2   LCD Display




                                     Figure 2: 4 Bit Interface of 16x2 LCD

Figure 2 showing a Liquid Crystal Display (LCD) which is 16 x 2 characters. It has 4 bit interface data
(D4,D5,D6,D7) which is parallel connected to the PIC port.
Document Reference
                       No.                            RPP-05                 Page. Number     Page |4
                                                                             Edition            1
                                                       LABORATORY            Revision No.        4
                           Document Title
                                                        PRACTICUM            Effective Date   03/8/2010
                                                                             Amendment Date   03/8/2010




         3.2.1   Pin Functions
Signal                      Function

                            Selects registers.
RS                          0: Instruction register (for write) Busy flag:
                            address counter (for read)
                            1: Data register (for write and read)
                            Selects read or write.
R/W                         0: Write
                            1: Read

E                           Starts data read/write.

                            Four high order bidirectional tristate data bus
                            pins. Used for data transfer and receive between
D4 to D7                    the PIC and the LCD. DB7 can be used
                            as a busy flag.

VSS
                            Ground
VDD
                            Power
VEE
                            Contact with variable resistor to control the LCD contrast
Document Reference
                       No.                        RPP-05                  Page. Number                 Page |5
                                                                          Edition                        1
                                                    LABORATORY            Revision No.                    4
                            Document Title
                                                     PRACTICUM            Effective Date               03/8/2010
                                                                          Amendment Date               03/8/2010




4     ATTENTION

       4.1     Do not move any IC or device inside the board without any order from your instructor.

       4.2     Make sure all jumpers on the development board are placed in correct positions.



5     EXPERIMENT PROCEDURE



       5.1.1    The code below is shown how to scan the keypad buttons at column 1 (button 1, 4, 7 and
5.1   KEYPAD (See Circuit 1)


                *). Pressed button will switch ON the LED base on the binary numbers of the button
                location. Ie. Button no. 1 = 0001, button no. 4 = 0100, button no. 7 = 0111, and button * =
                1111. Type the code below and test on the development board. Write your observation.
Document Reference
                     No.                       RPP-05                 Page. Number             Page |6
                                                                      Edition                    1
                                                 LABORATORY           Revision No.                 4
                            Document Title
                                                  PRACTICUM           Effective Date           03/8/2010
                                                                      Amendment Date           03/8/2010




5.2   Exercise 1 : Keypad


       5.2.1   Base on the code above, complete the source code, so that the PIC can scan all the pressed
               buttons and show it on LED as a binary value.

       5.2.2   Draw a flow chart for the complete program.




       5.3.1   The code below is a program to show texts in LCD 16x2. Type the code and test it on the
5.3   LCD Display (See Circuit 2)


               development board or Proteus simulation. Write your observation on the report.
Document Reference
                           No.                       RPP-05              Page. Number          Page |7
                                                                         Edition                 1
                                                       LABORATORY        Revision No.              4
                              Document Title
                                                        PRACTICUM        Effective Date        03/8/2010
                                                                         Amendment Date        03/8/2010




         5.4.1   Base on the circuit 2(see attachment). Write a program that will show a text “BUTTON IS
5.4     Exercise 2: LCD and Button(PORTA.F4)


                 PRESSED” on the LCD when the button at PORTA.F4 is pressed and show a text “BUTTON
                 IS NOT PRESSED” if the button at PORTA.F4 is not pressed.

         5.4.2   Draw a flow chart for a complete program.



6     REPORT PREPARATION AND SCHEMA.


(1)     2 persons for 1 report.

(2)     Due date to send report is 1 weeks after lab date.

(3)     Report schema following below requirements:

        Lab report cover sheet for 1st page.
        Objective, theory, equipments for the 2nd page. (5)                     (5M)
        Observations. (20)
         1.Keypad observations from 5.1.1                                       (10 M)
         2.LCD observations from 5.3.1                                          (10 M )
        Result. (40)
              1. Keypad: Exercise 1 source code & Flow Chart                    ( 20 M )
              2. LCD: Exercise 2 source code & Flow Chart                       (20 M)
        Discussion. (20)
      1. By using all the PORT A and PORT B, what is the maximum buttons for PIC16F877A can support?
         Draw a diagram to support your answer. (15 M)

      2. Give the example of applications that using a keypad with PIC. (5 M)
Document Reference
                    No.                    RPP-05              Page. Number     Page |8
                                                               Edition            1
                                             LABORATORY        Revision No.        4
                         Document Title
                                              PRACTICUM        Effective Date   03/8/2010
                                                               Amendment Date   03/8/2010



     Conclusions. (15)

7   CIRCUIT ATTACMENT




                                   Circuit 1: KEYPAD and LED
Document Reference
No.                   RPP-05               Page. Number     Page |9
                                           Edition            1
                        LABORATORY         Revision No.        4
   Document Title
                         PRACTICUM         Effective Date   03/8/2010
                                           Amendment Date   03/8/2010




              Circuit 2: LCD with Button

Más contenido relacionado

Destacado

Tutorial 2 amplitude modulation
Tutorial 2 amplitude  modulationTutorial 2 amplitude  modulation
Tutorial 2 amplitude modulationmkazree
 
120102011
120102011120102011
120102011mkazree
 
Tutorial chapter 3 robotic
Tutorial chapter 3 roboticTutorial chapter 3 robotic
Tutorial chapter 3 roboticmkazree
 
Chapter 5 fm receivers
Chapter 5  fm receiversChapter 5  fm receivers
Chapter 5 fm receiversmkazree
 
Foster-seely and Ratio Detector (Discriminator )
Foster-seely and Ratio Detector (Discriminator )Foster-seely and Ratio Detector (Discriminator )
Foster-seely and Ratio Detector (Discriminator )mkazree
 
Communication Engineering - Chapter 6 - Noise
Communication Engineering - Chapter 6 - NoiseCommunication Engineering - Chapter 6 - Noise
Communication Engineering - Chapter 6 - Noisemkazree
 
Embedded system (Chapter 2) part A
Embedded system (Chapter 2) part AEmbedded system (Chapter 2) part A
Embedded system (Chapter 2) part AIkhwan_Fakrudin
 
Embedded system (Chapter )
Embedded system (Chapter )Embedded system (Chapter )
Embedded system (Chapter )Ikhwan_Fakrudin
 
Contoh kertas kerja program
Contoh kertas kerja programContoh kertas kerja program
Contoh kertas kerja programmkazree
 
Chapter 1 dc machines new
Chapter 1 dc machines newChapter 1 dc machines new
Chapter 1 dc machines newmkazree
 
Ii20102011
Ii20102011Ii20102011
Ii20102011mkazree
 
Chapter5 dek 3143 dae 32303 9 (nota tambahan)
Chapter5 dek 3143 dae 32303 9 (nota tambahan)Chapter5 dek 3143 dae 32303 9 (nota tambahan)
Chapter5 dek 3143 dae 32303 9 (nota tambahan)mkazree
 
Chapter 3 induction machine
Chapter 3 induction machineChapter 3 induction machine
Chapter 3 induction machinemkazree
 
Performance of dc motors experiment 2
Performance of dc motors experiment 2Performance of dc motors experiment 2
Performance of dc motors experiment 2Karimi LordRamza
 
Induction generator and synchronous induction motor
Induction generator and synchronous induction motor Induction generator and synchronous induction motor
Induction generator and synchronous induction motor Pavithran Selvam
 
Chapter 2 transformer new
Chapter 2 transformer newChapter 2 transformer new
Chapter 2 transformer newmkazree
 
Projek rekabentuk
Projek rekabentukProjek rekabentuk
Projek rekabentukmkazree
 
Projek rekabentuk1
Projek rekabentuk1Projek rekabentuk1
Projek rekabentuk1mkazree
 
Chp1 68000 microprocessor copy
Chp1 68000 microprocessor   copyChp1 68000 microprocessor   copy
Chp1 68000 microprocessor copymkazree
 

Destacado (19)

Tutorial 2 amplitude modulation
Tutorial 2 amplitude  modulationTutorial 2 amplitude  modulation
Tutorial 2 amplitude modulation
 
120102011
120102011120102011
120102011
 
Tutorial chapter 3 robotic
Tutorial chapter 3 roboticTutorial chapter 3 robotic
Tutorial chapter 3 robotic
 
Chapter 5 fm receivers
Chapter 5  fm receiversChapter 5  fm receivers
Chapter 5 fm receivers
 
Foster-seely and Ratio Detector (Discriminator )
Foster-seely and Ratio Detector (Discriminator )Foster-seely and Ratio Detector (Discriminator )
Foster-seely and Ratio Detector (Discriminator )
 
Communication Engineering - Chapter 6 - Noise
Communication Engineering - Chapter 6 - NoiseCommunication Engineering - Chapter 6 - Noise
Communication Engineering - Chapter 6 - Noise
 
Embedded system (Chapter 2) part A
Embedded system (Chapter 2) part AEmbedded system (Chapter 2) part A
Embedded system (Chapter 2) part A
 
Embedded system (Chapter )
Embedded system (Chapter )Embedded system (Chapter )
Embedded system (Chapter )
 
Contoh kertas kerja program
Contoh kertas kerja programContoh kertas kerja program
Contoh kertas kerja program
 
Chapter 1 dc machines new
Chapter 1 dc machines newChapter 1 dc machines new
Chapter 1 dc machines new
 
Ii20102011
Ii20102011Ii20102011
Ii20102011
 
Chapter5 dek 3143 dae 32303 9 (nota tambahan)
Chapter5 dek 3143 dae 32303 9 (nota tambahan)Chapter5 dek 3143 dae 32303 9 (nota tambahan)
Chapter5 dek 3143 dae 32303 9 (nota tambahan)
 
Chapter 3 induction machine
Chapter 3 induction machineChapter 3 induction machine
Chapter 3 induction machine
 
Performance of dc motors experiment 2
Performance of dc motors experiment 2Performance of dc motors experiment 2
Performance of dc motors experiment 2
 
Induction generator and synchronous induction motor
Induction generator and synchronous induction motor Induction generator and synchronous induction motor
Induction generator and synchronous induction motor
 
Chapter 2 transformer new
Chapter 2 transformer newChapter 2 transformer new
Chapter 2 transformer new
 
Projek rekabentuk
Projek rekabentukProjek rekabentuk
Projek rekabentuk
 
Projek rekabentuk1
Projek rekabentuk1Projek rekabentuk1
Projek rekabentuk1
 
Chp1 68000 microprocessor copy
Chp1 68000 microprocessor   copyChp1 68000 microprocessor   copy
Chp1 68000 microprocessor copy
 

Más de mkazree

The Electronic Hobby Kit
The Electronic Hobby KitThe Electronic Hobby Kit
The Electronic Hobby Kitmkazree
 
Dek3223 chapter 2 robotic
Dek3223 chapter 2 roboticDek3223 chapter 2 robotic
Dek3223 chapter 2 roboticmkazree
 
Chapter 3 am receivers
Chapter 3 am receiversChapter 3 am receivers
Chapter 3 am receiversmkazree
 
Dek3223 chapter 3 industrial robotic
Dek3223 chapter 3 industrial roboticDek3223 chapter 3 industrial robotic
Dek3223 chapter 3 industrial roboticmkazree
 
Chapter 3 am receivers
Chapter 3 am receiversChapter 3 am receivers
Chapter 3 am receiversmkazree
 
Comm introduction
Comm introductionComm introduction
Comm introductionmkazree
 
Chapter2 cont
Chapter2 contChapter2 cont
Chapter2 contmkazree
 
Chapter 2 amplitude_modulation
Chapter 2 amplitude_modulationChapter 2 amplitude_modulation
Chapter 2 amplitude_modulationmkazree
 
Chp7 pic 16 f84 interfacing - copy
Chp7 pic 16 f84 interfacing - copyChp7 pic 16 f84 interfacing - copy
Chp7 pic 16 f84 interfacing - copymkazree
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copymkazree
 
Chp5 pic microcontroller instruction set copy
Chp5 pic microcontroller instruction set   copyChp5 pic microcontroller instruction set   copy
Chp5 pic microcontroller instruction set copymkazree
 
Chp4 introduction to the pic microcontroller copy
Chp4 introduction to the pic microcontroller   copyChp4 introduction to the pic microcontroller   copy
Chp4 introduction to the pic microcontroller copymkazree
 
Chp3 designing bus system, memory & io copy
Chp3 designing bus system, memory & io   copyChp3 designing bus system, memory & io   copy
Chp3 designing bus system, memory & io copymkazree
 
Chp2 introduction to the 68000 microprocessor copy
Chp2 introduction to the 68000 microprocessor   copyChp2 introduction to the 68000 microprocessor   copy
Chp2 introduction to the 68000 microprocessor copymkazree
 

Más de mkazree (14)

The Electronic Hobby Kit
The Electronic Hobby KitThe Electronic Hobby Kit
The Electronic Hobby Kit
 
Dek3223 chapter 2 robotic
Dek3223 chapter 2 roboticDek3223 chapter 2 robotic
Dek3223 chapter 2 robotic
 
Chapter 3 am receivers
Chapter 3 am receiversChapter 3 am receivers
Chapter 3 am receivers
 
Dek3223 chapter 3 industrial robotic
Dek3223 chapter 3 industrial roboticDek3223 chapter 3 industrial robotic
Dek3223 chapter 3 industrial robotic
 
Chapter 3 am receivers
Chapter 3 am receiversChapter 3 am receivers
Chapter 3 am receivers
 
Comm introduction
Comm introductionComm introduction
Comm introduction
 
Chapter2 cont
Chapter2 contChapter2 cont
Chapter2 cont
 
Chapter 2 amplitude_modulation
Chapter 2 amplitude_modulationChapter 2 amplitude_modulation
Chapter 2 amplitude_modulation
 
Chp7 pic 16 f84 interfacing - copy
Chp7 pic 16 f84 interfacing - copyChp7 pic 16 f84 interfacing - copy
Chp7 pic 16 f84 interfacing - copy
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
 
Chp5 pic microcontroller instruction set copy
Chp5 pic microcontroller instruction set   copyChp5 pic microcontroller instruction set   copy
Chp5 pic microcontroller instruction set copy
 
Chp4 introduction to the pic microcontroller copy
Chp4 introduction to the pic microcontroller   copyChp4 introduction to the pic microcontroller   copy
Chp4 introduction to the pic microcontroller copy
 
Chp3 designing bus system, memory & io copy
Chp3 designing bus system, memory & io   copyChp3 designing bus system, memory & io   copy
Chp3 designing bus system, memory & io copy
 
Chp2 introduction to the 68000 microprocessor copy
Chp2 introduction to the 68000 microprocessor   copyChp2 introduction to the 68000 microprocessor   copy
Chp2 introduction to the 68000 microprocessor copy
 

Último

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
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
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 

Último (20)

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
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)
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 

Lab 4 microcontroller

  • 1. CENTRE OF DIPLOMA STUDIES COMPUTER ADDED DESIGN LABORATORY LABORATORY INSTRUCTION SHEET DEK 3133 Subject Code and Name MICROCONTROLLER Experiment Code 04 Introduction to Keypad and LCD Experiment Title program Course Code DET/DEE/DEX
  • 2. Document Reference No. RPP-05 Page. Number Page |1 Edition 1 LABORATORY Revision No. 4 Document Title PRACTICUM Effective Date 03/8/2010 Amendment Date 03/8/2010 SUBJECT INFORMATION SUBJECT : DEK 3133 MICROCONTROLLER TOPIC : Lab 4 – Introduction to Keypad and LCD program. AIM To apply the knowledge and understanding on theory and applications of keypad. 1 OBJECTIVES 1.1 To understand the design of keypad. 1.2 To determine and analyze the function of keypad. 1.3 To understand the configuration of LCD. 2 EQUIPMENT 2.1 PIC Development Board – PICDEV 2.2 PIC16F877A 2.3 MPLAB IDE Program 2.4 Mikro C 2.5 Proteus 2.6 The PIC Development Board User manual 2.7 Power supply 9V 3 THEORY 3.1 KEYPAD SYSTEM Keypads are an excellent way of entering data into the microcontroller. The keys are usually numbered but they could be labeled as function keys, for example in a remote control handset in a TV to adjust the sound or color, etc. As well as remote controls, keypads find applications in burglar alarms, door entry system, calculators, microwave ovens, etc. Keypads are usually arranged in a matrix format to reduce the number of I/O connections. A 12 keypad is arranged in a 3 x 4 format requiring seven connections.
  • 3. Document Reference No. RPP-05 Page. Number Page |2 Edition 1 LABORATORY Revision No. 4 Document Title PRACTICUM Effective Date 03/8/2010 Amendment Date 03/8/2010 This is arranged in three columns and four rows as shown in Table 1. There are seven connections to the keypad – C1, C2, C3, R1, R2, R3 and R4. Column1,C1 Column2,C2 Coulmn3,C3 Row1, R1 1 2 3 Row2, R2 4 5 6 Row3, R3 7 8 9 Row4, R4 * 0 # Table 1 This connection to PIC is shown in Figure 1. The keypad works in the following way: If, for example, key 6 is pressed then A3 will be joined to B5. For key 1, A1 would be joined to B4, etc. as shown in Figure 1. Port A [1:3] = output Port B [0:3] = output and Port B [4:7] = input RA1 RA2 RB0 RA3 RB1 RB2 RB3 1 2 3 Row1 RB4 4 5 6 Row2 RB5 7 8 9 Row3 RB6 * 0 # Row4 RB7 Figure 1 The figure 1 above show the 4x3 keypad size which is 3 columns and 4 rows. To tell the PIC which button is pressed, the PIC need to set only one of the column to be high at one time. Then the PIC will scan which row is
  • 4. Document Reference No. RPP-05 Page. Number Page |3 Edition 1 LABORATORY Revision No. 4 Document Title PRACTICUM Effective Date 03/8/2010 Amendment Date 03/8/2010 at current column send the HIGH value (1) to the PIC input at PORTB. For example, Let say the PIC need to recognize the buttons at column 1 which the available button are 1, 4, 7 and *. So the PIC will send the PORTA.F1 (COLUMN 1) to HIGH (1). Then the PIC will scan each row of PORTB begin from PORTB.F4 (ROW 1). At this stage, if the scanned result is HIGH that means the pressed button is equal to 1. If the result is LOW (0), then the PIC will continue to scan for the next row(ROW2, ROW3, and ROW4). When all rows at PORTB are scanned, the PIC will send the HIGH (1) value to the next column (COLUMN 2 at PORTA.F2) and repeat to scan each row of port B. This process is repeated to all columns. When the last column (COLUMN3: PORTA.F3) is reached, PIC will scan again for all rows at column1, 2 and so on. The value need to submit to the columns and read the rows value are actually can be vary. It depends on how the keypad is designed. 3.2 LCD Display Figure 2: 4 Bit Interface of 16x2 LCD Figure 2 showing a Liquid Crystal Display (LCD) which is 16 x 2 characters. It has 4 bit interface data (D4,D5,D6,D7) which is parallel connected to the PIC port.
  • 5. Document Reference No. RPP-05 Page. Number Page |4 Edition 1 LABORATORY Revision No. 4 Document Title PRACTICUM Effective Date 03/8/2010 Amendment Date 03/8/2010 3.2.1 Pin Functions Signal Function Selects registers. RS 0: Instruction register (for write) Busy flag: address counter (for read) 1: Data register (for write and read) Selects read or write. R/W 0: Write 1: Read E Starts data read/write. Four high order bidirectional tristate data bus pins. Used for data transfer and receive between D4 to D7 the PIC and the LCD. DB7 can be used as a busy flag. VSS Ground VDD Power VEE Contact with variable resistor to control the LCD contrast
  • 6. Document Reference No. RPP-05 Page. Number Page |5 Edition 1 LABORATORY Revision No. 4 Document Title PRACTICUM Effective Date 03/8/2010 Amendment Date 03/8/2010 4 ATTENTION 4.1 Do not move any IC or device inside the board without any order from your instructor. 4.2 Make sure all jumpers on the development board are placed in correct positions. 5 EXPERIMENT PROCEDURE 5.1.1 The code below is shown how to scan the keypad buttons at column 1 (button 1, 4, 7 and 5.1 KEYPAD (See Circuit 1) *). Pressed button will switch ON the LED base on the binary numbers of the button location. Ie. Button no. 1 = 0001, button no. 4 = 0100, button no. 7 = 0111, and button * = 1111. Type the code below and test on the development board. Write your observation.
  • 7. Document Reference No. RPP-05 Page. Number Page |6 Edition 1 LABORATORY Revision No. 4 Document Title PRACTICUM Effective Date 03/8/2010 Amendment Date 03/8/2010 5.2 Exercise 1 : Keypad 5.2.1 Base on the code above, complete the source code, so that the PIC can scan all the pressed buttons and show it on LED as a binary value. 5.2.2 Draw a flow chart for the complete program. 5.3.1 The code below is a program to show texts in LCD 16x2. Type the code and test it on the 5.3 LCD Display (See Circuit 2) development board or Proteus simulation. Write your observation on the report.
  • 8. Document Reference No. RPP-05 Page. Number Page |7 Edition 1 LABORATORY Revision No. 4 Document Title PRACTICUM Effective Date 03/8/2010 Amendment Date 03/8/2010 5.4.1 Base on the circuit 2(see attachment). Write a program that will show a text “BUTTON IS 5.4 Exercise 2: LCD and Button(PORTA.F4) PRESSED” on the LCD when the button at PORTA.F4 is pressed and show a text “BUTTON IS NOT PRESSED” if the button at PORTA.F4 is not pressed. 5.4.2 Draw a flow chart for a complete program. 6 REPORT PREPARATION AND SCHEMA. (1) 2 persons for 1 report. (2) Due date to send report is 1 weeks after lab date. (3) Report schema following below requirements: Lab report cover sheet for 1st page. Objective, theory, equipments for the 2nd page. (5) (5M) Observations. (20) 1.Keypad observations from 5.1.1 (10 M) 2.LCD observations from 5.3.1 (10 M ) Result. (40) 1. Keypad: Exercise 1 source code & Flow Chart ( 20 M ) 2. LCD: Exercise 2 source code & Flow Chart (20 M) Discussion. (20) 1. By using all the PORT A and PORT B, what is the maximum buttons for PIC16F877A can support? Draw a diagram to support your answer. (15 M) 2. Give the example of applications that using a keypad with PIC. (5 M)
  • 9. Document Reference No. RPP-05 Page. Number Page |8 Edition 1 LABORATORY Revision No. 4 Document Title PRACTICUM Effective Date 03/8/2010 Amendment Date 03/8/2010 Conclusions. (15) 7 CIRCUIT ATTACMENT Circuit 1: KEYPAD and LED
  • 10. Document Reference No. RPP-05 Page. Number Page |9 Edition 1 LABORATORY Revision No. 4 Document Title PRACTICUM Effective Date 03/8/2010 Amendment Date 03/8/2010 Circuit 2: LCD with Button