Keybrd Interface Class

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 !he debounce "eriod for a key is #0$s %se software debouncing techni&ue '()%+,( is an a -ailable #0$s delay routine .olution: Port A is used as output port for selecting a row of key s while Port B is used as an input port for sensing a closed key. hus the keyboard lines are selected on e by  one through port A and the port B lines are polled continuously till a key closure is sensed. he routine  !"B#$%&" is called for key debouncing. he key code is depending upon the selected row and a low sensed colu'n.

Transcript of Keybrd Interface Class

Page 1: Keybrd Interface Class

7/24/2019 Keybrd Interface Class

http://slidepdf.com/reader/full/keybrd-interface-class 1/6

Interfacing Keyboard with 8086

  Interface a 4 * 4 keyboard with 8086 using 8255 an writean ALP for detecting a key closure and return the key codein AL !he debounce "eriod for a key is #0$s %se softwaredebouncing techni&ue '()%+,( is an a-ailable #0$sdelay routine

.olution: Port A is used as output port for selecting a row of keyswhile Port B is used as an input port for sensing aclosed key. hus the keyboard lines are selected one by

  one through port A and the port B lines are polledcontinuously till a key closure is sensed. he routine

  !"B#$%&" is called for key debouncing. he key

code is depending upon the selected row and a lowsensed colu'n.

Page 2: Keybrd Interface Class

7/24/2019 Keybrd Interface Class

http://slidepdf.com/reader/full/keybrd-interface-class 2/6

Interfacing ()( Keyboard

Page 3: Keybrd Interface Class

7/24/2019 Keybrd Interface Class

http://slidepdf.com/reader/full/keybrd-interface-class 3/6

Interfacing ()( Keyboard

• he higher order lines of port A and port B are left unused.he address of port A and port B will respecti*ely 8000+ and800,+ while address of &- will be 8006+. he flow chartof the co'plete progra' is as gi*en. he control word for this

 proble' will be 8,+. &ode seg'ent &/ is used for storing the progra' code.

• /ey 'ebounce : -hene*er a 'echanical pushbutton is pressed or released once1 the 'echanical co'ponents of thekey do not change the position s'oothly1 rather it generates a

transient response .

Page 4: Keybrd Interface Class

7/24/2019 Keybrd Interface Class

http://slidepdf.com/reader/full/keybrd-interface-class 4/6

Interfacing ()( Keyboard

Page 5: Keybrd Interface Class

7/24/2019 Keybrd Interface Class

http://slidepdf.com/reader/full/keybrd-interface-class 5/6

ASSUME CS:CODE

CODE SEGMENT

  MOVAL,82H  OUT CWR,AL

  MOV BL,00h ; key vale

  !OR A!,A! ; "lea# all$a%&

  OUT 'A,AL

Wa(): *N AL,'B

  AND AL,0+

  CM' AL,0+

  - Wa()  CALL De./"e

  MOV AL,1+H

  MOV BH,0 ; R/3"/)

Ne4)#/3: ROL AL,05

  MOV CH,AL

  OUT 'A,AL

  *N AL,'B

  AND AL,0+

  MOV CL,0

;C/l"/)

Ne4)"/l: RCR AL,05

  NC 6ey

*NC BL

  DEC CL

  N- Ne4)"/l

  MOV AL,CH  DEC BH

  N- Ne4)#/3

  M' Wa()

  6ey: MOV AL,BL  *NT 7H

Page 6: Keybrd Interface Class

7/24/2019 Keybrd Interface Class

http://slidepdf.com/reader/full/keybrd-interface-class 6/6

De./"e 'ROC NEAR

  MOV CL,0++HBa"k: NO'

  DEC CL

  N- Ba"k

  De./"e END'  CODE ENDS