Assembly code for Matrix Keypad (4x3)
Sample code for Matrix Keypad (4x3).
Following code can be using for 8051 and 8052 ICs like: 89c51, 89c52, 89s51, 89s52, 89c2051.
;========================================================== ; Pin Definations ;========================================================== keypad equ 90h key1 equ 90h key2 equ 91h key3 equ 92h key4 equ 93h key5 equ 94h key6 equ 95h key7 equ 96h ;========================================================== ; Main Program starts from here ;========================================================== loop: mov a,keypad orl a,#7fh mov keypad,a clr key4 jb key1,chkkey2 call debounce jb key1,chkkey2 jnb key1,$ mov @r0,#01h inc r0 mov lcddatabus,#'1' call lcddata chkkey2 jb key2,chkkey3 call debounce jb key2,chkkey3 jnb key2,$ mov @r0,#02h inc r0 mov lcddatabus,#'2' call lcddata chkkey3 jb key3,chkkey4 call debounce jb key3,chkkey4 jnb key3,$ mov @r0,#03h inc r0 mov lcddatabus,#'3' call lcddata chkkey4 mov a,keypad orl a,#7fh mov keypad,a clr key5 jb key1,chkkey5 call debounce jb key1,chkkey5 jnb key1,$ mov @r0,#04h inc r0 mov lcddatabus,#'4' call lcddata chkkey5 jb key2,chkkey6 call debounce jb key2,chkkey6 jnb key2,$ mov @r0,#05h inc r0 mov lcddatabus,#'5' call lcddata chkkey6 jb key3,chkkey7 call debounce jb key3,chkkey7 jnb key3,$ mov @r0,#06h inc r0 mov lcddatabus,#'6' call lcddata chkkey7 mov a,keypad orl a,#7fh mov keypad,a clr key6 jb key1,chkkey8 call debounce jb key1,chkkey8 jnb key1,$ mov @r0,#07h inc r0 mov lcddatabus,#'7' call lcddata chkkey8 jb key2,chkkey9 call debounce jb key2,chkkey9 jnb key2,$ mov @r0,#08h inc r0 mov lcddatabus,#'8' call lcddata chkkey9 jb key3,chkkey10 call debounce jb key3,chkkey10 jnb key3,$ mov @r0,#09h inc r0 mov lcddatabus,#'9' call lcddata chkkey10 mov a,keypad orl a,#7fh mov keypad,a clr key7 jb key2,chkkey11 call debounce jb key2,chkkey11 jnb key2,$ mov @r0,#00h inc r0 mov lcddatabus,#'0' call lcddata chkkey11 jb key3,chkkey12 call debounce jb key3,chkkey12 jnb key3,$ jmp back_esc chkkey12 jb key1,chkkeyend call debounce jb key1,chkkeyend mov dptr,#msgplzwait call lcddisp call display_dot jnb key1,$ call check_pw_one jnb 01h,pwd_two jmp correct_pw ;===================================================== ; Program ENDS here ;=====================================================
Highlights
-
List of Projects
Navigate through wide range of projects of 8051. Applications including ADC, DAC, LCD, Matrix LEDs, Keypad, Stepper Motor, DC motor, EEPROM, Relay, Timer, Sensors, RTC and much more.
Pick and Place Robot Temperature & Light Controller Rolling Display Matrix LEDs Person Counter & Password Detector Home Security System Data Logger Greenhouse monitor & control Flow computer Electronic Voting Machine Pick & Place Robot Temperature & Light Controller Rolling Display Matrix LEDs Person Counter & Password Detector Data Logger Home Security System Greenhouse monitor & control Flow computer
Read More