PIC Lesson: Keypad

Keypad adalah satu set button yang disambung secara matrix. Kelebihan menggunakan keypad berbanding menggunakan button biasa adalah keypad memberikan lebih banyak button dan kurang I/O port. Contoh 4X4 keypad, memerlukan 8 port kerana ia disambung secara matrix.

Anda boleh juga membina sambungan sendiri dengan menggunakan push button. Sambungan bagi keypad adalah seperti di bawah.

Keypad adalah input module tetapi programnya perlu setkan 4 port sebagai input dan 4 port sebagai output.

Di bawah adalah videonya

Video keypad dengan seven segment

Video keypad dengan LCD HD44780

Video keypad dengan LCD Nokia 3310

PIC Source Code

36 Replies to “PIC Lesson: Keypad”

  1. Ok Shahrul…That means do we need to adjust anything in libraryhardware.h??? Which software do you use to compile it???mplab or mplab x???

  2. Hi Shahrul….In your source code i was identified that (#define SHAHRULNIZAM)…….If i rename it (#define AZRUL) in your source code means did have any error in source code when compiling??Can you explain it…

  3. hello, i have a problem with my keypad, i use keypad at portB and LCD at portD and LVP disable, all of setting to PORTB as input keypad I’ve done but my keypad still not working. so, where is my mistake? thanks

    here my code
    OPTION_REG.B7 = 0; //Enable pullup resistor
    TRISB = 1;
    PORTB.F0 = 0;
    PORTB.F1 = 0;
    PORTB.F2 = 0;
    PORTB.F3 = 0;
    PORTB.F4 = 1;
    PORTB.F5 = 1;
    PORTB.F6 = 1;
    PORTB.F7 = 1;

  4. Hi, I’m interested in your work. It fascinates me. I had a few questions, such as. In your code you had
    #include “LibraryHardware.h” //is this the pic itself?
    #if defined (HD44780)
    #include “LibraryUniversalDisplay.h” //what is this? if its an lcd? do i actually have to define it? I know if your doing a send function, including the name of the lcd isn’t actually required.
    #elif defined (PCD8544)
    #include “LibraryChar.h” //what is this
    #include “LibraryUniversalDisplay.h” //what is this?
    # endif
    I’d like to test this myself, but I can’t seem to understand what the Library code represents, if you could assist me I’d appreciate that.

  5. boleh terangkan sedikit macam mane nak tukar 7-segamnt kepada output LED sahaja.. dan untuk #include “LibraryHardware.h” untuk fine apa ya?

    1. Dah cakap dah, sebab sambungan nya matrix, x boleh semua input.
      Jgn buang masa saya dgn soalan simple mcm ni, lebih baik tanya pada your lecturer. Saya bukan lecturer untuk cover subjek ni.

  6. Keypad adalah input module tetapi programnya perlu setkan 4 port sebagai input dan 4 port sebagai output

    kenapa ?

  7. sy ada try buat program ni bila, compile program nie tapi still ada error undefined MCLRE_ON mcm mne nk bt….

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.