The document describes interfacing a 4x4 keyboard with an 8086 microprocessor using an 8255 programmable peripheral interface. It involves using Port A to select keyboard rows, polling Port B to detect key presses, and calling a DEBOUNCE routine to software debounce keys. When a key press is detected, the AL register returns the key code based on the row and column.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
31 views6 pages
Keybrd Interface Class
The document describes interfacing a 4x4 keyboard with an 8086 microprocessor using an 8255 programmable peripheral interface. It involves using Port A to select keyboard rows, polling Port B to detect key presses, and calling a DEBOUNCE routine to software debounce keys. When a key press is detected, the AL register returns the key code based on the row and column.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 6
Interfacing Keyboard with 8086
Interface a 4 * 4 keyboard with 8086 using 8255 an write
an ALP for detecting a key closure and return the key code in AL. The debounce period for a key is 10ms. Use software debouncing technique. DEBOUNCE is an available 10ms delay routine. Solution: Port A is used as output port for selecting a row of keys while Port B is used as an input port for sensing a closed key. Thus the keyboard lines are selected one by one through port A and the port B lines are polled continuously till a key closure is sensed. The routine DEBOUNCE is called for key debouncing. The key code is depending upon the selected row and a low sensed column.
Interfacing 4*4 Keyboard
Interfacing 4*4 Keyboard
The higher order lines of port A and port B are left unused. The address of port A and port B will respectively 8000H and 8002H while address of CWR will be 8006H. The flow chart of the complete program is as given. The control word for this problem will be 82H. Code segment CS is used for storing the program code. Key Debounce : Whenever a mechanical push-button is pressed or released once, the mechanical components of the key do not change the position smoothly, rather it generates a transient response .
Interfacing 4*4 Keyboard
ASSUME CS:CODE CODE SEGMENT
MOVAL,82H OUT CWR,AL MOV BL,00h ; key value XOR AX,AX ; clear all flags OUT PA,AL Wait: IN AL,PB AND AL,0F CMP AL,0F JZ Wait CALL Debounce MOV AL,7FH MOV BH,04 ; Rowcount
Nextrow: ROL AL,01
MOV CH,AL OUT PA,AL IN AL,PB AND AL,0F MOV CL,04 ;Colcount Nextcol: RCR AL,01 JNC Key INC BL DEC CL JNZ Nextcol MOV AL,CH DEC BH JNZ Nextrow JMP Wait Key: MOV AL,BL INT 3H
Debounce PROC NEAR
MOV CL,0FFH Back: NOP DEC CL JNZ Back Debounce ENDP CODE ENDS