of course, here is the code, please help me where is the mistake.. while i press on keypad 0 until 7, it's work with no errors, but up to 7, the output always 1010
$MOD2051
$OBJECT
ROW0 EQU P1.0
ROW1 EQU P1.1
ROW2 EQU P1.2
ROW3 EQU P1.3
ALERT EQU P3.7
ORG 00H
AJMP START
START:
SETB ALERT
;-------------------------------WAIT TILL KEY RELEASED-------------------------------------------
MAIN1:
MOV P1,#0F0H
MOV A,P1
ANL A,#11110000B
CJNE A,#11110000B,MAIN1
;-------------------------------WAIT TILL KEY PRESSED--------------------------------------------
LOOP1:
ACALL DELAY
MOV A,P1
ANL A,#11110000B
CJNE A,#11110000B,CHECK_BOUNCE
AJMP LOOP1
CHECK_BOUNCE:
ACALL DELAY
MOV A,P1
ANL A,#11110000B
CJNE A,#11110000B,CHECK_BARIS
AJMP LOOP1
;-------------------------------------SCAN BARIS-------------------------------------------------
CHECK_BARIS:
CLR ROW0
SETB ROW1
SETB ROW2
SETB ROW3
MOV A,P1
ANL A,#11111110B
CJNE A,#11111110B,BARIS_0
;------------------------------------------------------------------------------------------------
SETB ROW0
CLR ROW1
SETB ROW2
SETB ROW3
MOV A,P1
ANL A,#11111101B
CJNE A,#11111101B,BARIS_1 ;CEK ROW 1
;------------------------------------------------------------------------------------------------
SETB ROW0
SETB ROW1
CLR ROW2
SETB ROW3
MOV A,P1
ANL A,#11111011B
CJNE A,#11111011B,BARIS_2 ;CEK ROW 2
;------------------------------------------------------------------------------------------------
SETB ROW0
SETB ROW1
SETB ROW2
CLR ROW3
MOV A,P1
ANL A,#11110111B
CJNE A,#11110111B,BARIS_3 ;CEK ROW 3
AJMP LOOP1
;------------------------------------------------------------------------------------------------
BARIS_0:
MOV DPTR,#ISI_ROW0
AJMP FIND_CLMN
BARIS_1:
MOV DPTR,#ISI_ROW1
AJMP FIND_CLMN
BARIS_2:
MOV DPTR,#ISI_ROW2
AJMP FIND_CLMN
BARIS_3:
MOV DPTR,#ISI_ROW3
AJMP FIND_CLMN
;------------------------------------------------------------------------------------------------
FIND_CLMN:
RLC A
JNC FOUND
INC DPTR
AJMP FIND_CLMN
;------------------------------------------------------------------------------------------------
FOUND:
MOV A,#00H
MOVC A,@A+DPTR
MOV P3,A
;MOV P0,A
CLR ALERT
ACALL DELAY
ACALL DELAY
ACALL DELAY
SETB ALERT
LJMP START
;-------------------------------------DELAY------------------------------------------------------
DELAY:
MOV R0,#36
DELAY1:
MOV R1,#0FFH
DJNZ R1,$
DJNZ R0,DELAY1
RET
;------------------------------------DEFINE DATA-------------------------------------------------
ORG 350H
ISI_ROW0: DB 0H,1H,2H,3H
ISI_ROW1: DB 4H,5H,6H,7H
ISI_ROW2: DB 8H,9H,0AH,0BH
ISI_ROW3: DB 0CH,0DH,0EH,0FH
END