Keyboard and Display

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

INTERFACING HEX KEYBOARD WITH 8086 KIT:

This program is used to interface an external hex keypad with MP-86L kit.
Input clock to 8279 is 3MHZ. The program waits for a key to be entered from
the keypad and the row and column matrix of the depressed key is stored in
Acc register.

16 Keys are arranged in 4 X 4 matrix. Their scan codes are as follows


21H 22H 23H 24H
19H 1AH 1BH 1CH
11H 12H 13H 14H
09H 0AH 0BH OCH

I/O PORT ADDRESSES FOR 8279 :


FF50H - Data Register
FF52H - Status Register

OUTPUT: scan code of the depressed key is at Acc


8086 KEYBOARD PROGRAM:
ADDRES LABEL OPCODE MNEMONICS COMMENTS
S
1000 B0 12 MOV AL,12H CONTROL WORD
1002 BA 52 FF MOV DX,FF52H CONTROL & STATUS REG
1005 EE OUT DX,AL OUT TO 8279
1006 B0 3E MOV AL,3EH FOR FREQ DIVISION
1008 EE OUT DX,AL OUT TO 8279
1009 B0 A0 MOV AL,A0H DISPLAY/WRITE INHIBIT
100B EE OUT DX,AL OUT TO 8279
100C L1 EC IN AL,DX READ STATUS OF 8279
100D 24 01 AND AL,01H FIFO EMPTY?
100F 74 FB JE 100CH(L1) IF YES LOOP BACK
1011 BA 50 FF MOV DX,FF50H CHARACTER IS AVAILABLE
1014 EC IN AL,DX READ CODE FROM DATA PORT
1015 24 3F AND AL,3FH SUPRESS UNWANTED BITS
1017 CC INT 3 BREAK POINT
INTERFACING 7 SEGMENT DISPLAY WITH 8086 KIT

This program is will display the character for the given 7 segment code on all
the digits of the display.
INPUT: Enter the seven segment code at 2000h.
For example - 2000: BA (seven segment code for 2)
I/O PORT ADDRESSES FOR 8279 :
FF52H - Data Register
FF50H - Status Register

7 SEGMENT CODES FOR 0 TO F:

FC 60 BA F2 66 D6 DE 70 FE 76 7E CE 9C EA 9E 1E

7 SEGMENT CODE FORMAT:

Char D C B A E F G H Hex code


0 1 1 1 1 1 1 0 0 FC
1 0 1 1 0 0 0 0 0 60
a
f b
g
e c

d .h
8086 DISPLAY PROGRAM:
ADDRES LABEL OPCODE MNEMONICS COMMENTS
S
1050 B0 12 MOV AL,12H CONTROL WORD
1052 BA 52 FF MOV DX,FF52H CONTROL & STATUS REG
1055 EE OUT DX,AL OUT TO 8279
1056 B0 3E MOV AL,3EH FOR FREQ DIVISION
1058 EE OUT DX,AL OUT TO 8279
1059 B0 A0 MOV AL,A0H DISPLAY/WRITE INHIBIT
105B EE OUT DX,AL OUT TO 8279
105C B4 08 MOV AH,08H COUNT OF 8 FOR CLEARING DIS.
105E BA 50 FF MOV DX,FF50H DATA REGISTER ADDRESS
1061 B0 00 MOV AL,00H DATA =0
1063 L1 EE OUT DX,AL OUT TO 8279
1064 FE CC DEC AH DECREMENT LOOP COUNT
1066 75 FB JNE 1063H(L1) WAIT TILL ZERO
1068 L2 BA 52 FF MOV DX,FF52H STATUS REGISTER ADDRESS
106B EC IN AL,DX READ STATUS OF 8279
106C L3 24 01 AND AL,01H FIFO EMPTY?
106E 74 FC JE 106CH(L3) IF YES LOOP BACK
1070 BA 50 FF MOV DX,FF50H DATA REGISTER ADDRESS
1073 BB 00 20 MOV BX,2000H DATA I/P ADDRESS
1076 8A 07 MOV AL,[BX] READ THE INPUT CODE
1078 EE OUT DX,AL TO 8279 DATA REGISTER
1079 EB ED JMP 1068H(L2) JMP L2

You might also like