SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Andere mochten auch

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
 

Andere mochten auch (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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
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
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 

Kürzlich hochgeladen (20)

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
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
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 

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