loading...
Rangkaian saklar for mikrokontroler AT89S51/52
Port mikrokontroler AT89S51/52 The complete internal pull-up, a default condition so that it is high. To make this port as input, we live to provide logic high or ignore in the default condition. If we want a legible entries we should use the Low input signal.
In the picture below, when the button on the keypad and press the low signal will be sent to port 3 on mikrokontroler, Thus, this port will have a logic in accordance with the key emphasis
Port mikrokontroler AT89S51/52 The complete internal pull-up, a default condition so that it is high. To make this port as input, we live to provide logic high or ignore in the default condition. If we want a legible entries we should use the Low input signal.
In the picture below, when the button on the keypad and press the low signal will be sent to port 3 on mikrokontroler, Thus, this port will have a logic in accordance with the key emphasis
;---------------------------------------------------------------------
; Simulasi penekanan tombol pd P3.0 untuk menghidupkan
; dan P3.1 untuk mematikan LED pada Port 1
;----------------------------------------------------------------------
ORG 0H
MULAI:
MOV A,P3 ; Baca port 3
CJNE A,#0FEH,TERUS ; Apakah isi akumulator = 11111110B
MOV P1,#000H ; Ya! Hidupkan lampu LED di port 1
SJMP MULAI ; Ulangi lagi dari awal
TERUS:
CJNE A,#0FDH,MULAI ; Apakah isi akumulator = 11111101B
MOV P1,#0FFH ; Ya! Matikan lampu LED di port 1
SJMP MULAI ; Ulangi lagi dari awal
END
program on the work which led to the connects to the port 1, while s1 in press led will be flame and when off in the pressm S2
program on the work, which led to the connects to the port 1, while s1 in press, and led a flame, and when out in the press and S2
How it works, the program:
When the switch connected to P3.0 in the press, the data on the port 3 is 11111110 binary or 0FE Hexa, the program will know the content of the port 3 if data is same (0FE H) Led then switched to the port 1, if any emphasis P3.1 , the data on the port 3 11111101 binary or 0FD Hexa, program will check the content of port 3 if data is found in the Led on the port 1 will be turned off
program on the work, which led to the connects to the port 1, while s1 in press, and led a flame, and when out in the press and S2
How it works, the program:
When the switch connected to P3.0 in the press, the data on the port 3 is 11111110 binary or 0FE Hexa, the program will know the content of the port 3 if data is same (0FE H) Led then switched to the port 1, if any emphasis P3.1 , the data on the port 3 11111101 binary or 0FD Hexa, program will check the content of port 3 if data is found in the Led on the port 1 will be turned off
Rangkaian Keypad Matrix
4 x 4 Keypad is a keypad measuring 4 columns x 4 rows. This module can be enabled as an input in the applications such as digital security, datalogger, attendance, motor speed controllers, robotik, and so forth.
Hardware Specifications
- Has a 16 button (function button depending on the application).
- Configuration has 4 lines (input scanning) and column 4 (output scanning).
;=======================================
; PROGRAM KEYPAD 4X4 DIPASANG
; PADA PORT 0, OUTPUT PADA PORT 1
;=======================================
KOLOM1 BIT P0.0
KOLOM2 BIT P0.1
KOLOM3 BIT P0.2
KOLOM4 BIT P0.3
BARIS1 BIT P0.4
BARIS2 BIT P0.5
BARIS3 BIT P0.6
BARIS4 BIT P0.7
KEYPORT EQU P0 ; KEYPAD CONNECT KE PORT 0
KEYDATA EQU 50H ; MEMORY DATA UNTUK KEYPAD
KEYBOUNC EQU 51H ; MEMORY UNTUK ANTI BOUNCING
ORG 0H
ULANG:
CALL KEYPAD ; PANGGIL SUB RUTIN KEYPAD
MOV A,KEYDATA
CJNE A,#0FFH,DITEKAN
JMP ULANG
DITEKAN:
CPL A
MOV P1,A
DJNZ R0,$
JMP ULANG
KEYPAD:
MOV KEYBOUNC,#100 ; KONSTANTA ANTI BOUNCING
MOV KEYPORT,#0FFH ; PORT KEY PAD
CLR KOLOM1 ; SCAN KOLOM 1
UL1: JB BARIS1,KEY1 ; TOMBOL 1 DITEKAN?
CALL DELAY
DJNZ KEYBOUNC,UL1
MOV KEYDATA,#1 ; ISI REG. DATA DGN 1
RET
KEY1: JB BARIS2,KEY2 ; TOMBOL 2 DITEKAN?
CALL DELAY
DJNZ KEYBOUNC,KEY1
MOV KEYDATA,#4
RET
KEY2: JB BARIS3,KEY3
CALL DELAY
DJNZ KEYBOUNC,KEY2
MOV KEYDATA,#7
RET
KEY3: JB BARIS4,KEY4
CALL DELAY
DJNZ KEYBOUNC,KEY3
MOV KEYDATA,#0AH
RET
KEY4: SETB KOLOM1
CLR KOLOM2
JB BARIS1,KEY5
CALL DELAY
DJNZ KEYBOUNC,KEY4
MOV KEYDATA,#2
RET
KEY5: JB BARIS2,KEY6
CALL DELAY
DJNZ KEYBOUNC,KEY5
MOV KEYDATA,#5
RET
KEY6: JB BARIS3,KEY7
CALL DELAY
DJNZ KEYBOUNC,KEY6
MOV KEYDATA,#8
RET
KEY7: JB BARIS4,KEY8
CALL DELAY
DJNZ KEYBOUNC,KEY7
MOV KEYDATA,#0
RET
KEY8: SETB KOLOM2
CLR KOLOM3
JB BARIS1,KEY9
CALL DELAY
DJNZ KEYBOUNC,KEY8
MOV KEYDATA,#3
RET
KEY9: JB BARIS2,KEY10
CALL DELAY
DJNZ KEYBOUNC,KEY9
MOV KEYDATA,#6
RET
KEY10: JB BARIS3,KEY11
CALL DELAY
DJNZ KEYBOUNC,KEY10
MOV KEYDATA,#9
RET
KEY11: JB BARIS4,KEY12
CALL DELAY
DJNZ KEYBOUNC,KEY11
MOV KEYDATA,#0BH
RET
KEY12: SETB KOLOM3
CLR KOLOM4
JB BARIS1,KEY13
CALL DELAY
DJNZ KEYBOUNC,KEY12
MOV KEYDATA,#0CH
RET
KEY13: JB BARIS2,KEY14
CALL DELAY
DJNZ KEYBOUNC,KEY13
MOV KEYDATA,#0DH
RET
KEY14: JB BARIS3,KEY15
CALL DELAY
DJNZ KEYBOUNC,KEY14
MOV KEYDATA,#0EH
RET
KEY15: JB BARIS4,KEY16
CALL DELAY
DJNZ KEYBOUNC,KEY15
MOV KEYDATA,#0FH
RET
KEY16: MOV KEYDATA,#0FFH
RET
DELAY:
DJNZ R0,$
RET
END
0 Response to "Rangkaian Saklar|Keypad Matrix AT89S51/52"
Post a Comment