一、實驗目的
?? 1、掌握8031系統(tǒng)中,擴展8279鍵盤顯示接口的方法。
2、掌握8279工作原理和編程方法。
二、實驗內容
1.實驗原理圖:
?
2、實驗內容
???? 在外接的鍵盤功能板上,按數(shù)字鍵,數(shù)碼管上應相應能顯示按下的數(shù)字,按下功能鍵,能相應執(zhí)行其它功能程序。
3、實驗說明
利用8279可以實現(xiàn)對鍵盤/顯示器的自動掃描,以減輕CPU負擔,具有顯示穩(wěn)定,程序簡單,不會出現(xiàn)誤動作等特點。本實驗利用8279實現(xiàn)顯示掃描自動化。
三、程序
程序清單:
????????????? ORG???? 08F0H
HA7S:??? MOV??? SP,#53H
????????????? MOV???? DPTR,#0B001H
????????????? MOV??? A,#00H
????????????? MOVX??????? @DPTR,A
????????????? MOV??? A,#32H
????????????? MOVX??????? @DPTR,A
????????????? MOV??? A,#0DFH
????????????? MOVX??????? @DPTR,A
HA7S1:? MOVX??????? A,@DPTR
????????????? JB???????? ACC.7,HA7S1
????????????? MOV??? DPTR,#0B000H
????????????? MOV??? A,#0C8H
????????????? MOVX??????? @DPTR,A
????????????? INC????? DPTR
????????????? MOV??? A,#80H
????????????? MOVX??????? @DPTR,A
HA7S2:? MOV??? 30H,#80H
????????????? MOV??? 31H,#40H
HA7S3:? MOV??? DPTR,#0B001H
????????????? MOVX??????? A,@DPTR
????????????? ANL???? A,#07H
????????????? CJNE???? A,#00H,HA7S4
????????????? AJMP??? HA7S3
HA7S4:? MOV??? DPTR,#0B000H
????????????? MOVX??????? A,@DPTR
????????????? MOV??? B,A
????????????? MOV??? R1,#00H
????????????? MOV??? DPTR,#KEYTAB
HA7S5:? MOV??? A,#00H
????????????? MOVC? A,@A+DPTR
????????????? CJNE??? A,B,HA7S6
????????????? AJMP?? HA7SA
HA7S6:? INC????? DPTR
????????????? INC????? R1
????????????? MOV??? A,R1
????????????? JB???????? ACC.4,HA7S7
????????????? AJMP?? HA7S5
HA7S7:? MOV??? R1,#00H
?????? MOV??? DPTR,#KEYTAB1
HA7S8:? MOV??? A,#00H
????????????? MOVC??????? A,@A+DPTR
????????????? CJNE??? A,B,HA7S9
????????????? AJMP?? HA7SC
HA7S9:? INC????? DPTR
????????????? INC????? R1
????????????? MOV??? A,R1
????????????? JNB????? ACC.2,HA7S8
????????????? AJMP?? HA7SD
HA7SD: LJMP??? HA7S
HA7SA: MOV??? A,30H
????????????? MOV??? DPTR,#0B001H
????????????? MOVX??????? @DPTR,A
????????????? MOV??? A,R1
????????????? MOV??? R0,31H
????????????? MOV??? @R0,A
????????????? INC????? 31H
????????????? MOV??? DPTR,#CDATA
????????????? MOVC??????? A,@A+DPTR
????????????? MOV??? DPTR,#0B000H
????????????? MOVX??????? @DPTR,A
????????????? INC????? 30H
????????????? MOV??? A,30H
????????????? CJNE??? A,#88H,HA7SB
????????????? LJMP??? HA7S2
HA7SB: AJMP?? HA7S3
HA7SC: MOV??? DPTR,#KJPADDR
????????????? MOV??? A,R1
????????????? RLA
????????????? ADD???? A,R1
????????????? JMP????? @A+DPTR
KJPADDR:LJMP?????? LOOP0
????????????? LJMP??? LOOP1
????????????? LJMP??? LOOP2
KEYTAB: DB 0C1H,0C8H,0C9H,0D0H,0D8H,0E0H,0C2H,0CAH,0D1H,0D9H
????????????? DB 0DAH,0C3H,0CBH,0D2H,0D3H,0DBH
KEYTAB1:DB 0E3H,0E2H,0E1H
CDATA: DB 0CH,9FH,4AH,0BH,99H,29H,28H,8FH,08H,09H,88H,38H
????????????? DB 6CH,1AH,68H,0E8H
LOOP0: MOV??? R5,#0CH
????????????? LJMP???? DISPC
LOOP1: MOV??? R5,#9FH
????????????? LJMP??? DISPC
LOOP2: MOV??? R5,#4AH
DISPC:? MOV??? R6,#80H
DISPC1: MOV?? A,R6
????????????? MOV??? DPTR,#0B001H
????????????? MOVX??????? @DPTR,A
????????????? MOV??? A,R5
????????????? MOV??? DPTR,#0B000H
????????????? MOVX??????? @DPTR,A
????????????? MOV??? R2,#20H
????????????? LCALL??????? DELAY
????????????? MOV??? A,#0FFH
????????????? MOVX??????? @DPTR,A
????????????? INC????? R6
????????????? CJNE??? R6,#88H,DISPC1
????????????? AJMP?? DISPC
DELAY: PUSH?? 02H
DELAY1: PUSH??????? 02H
DELAY2: PUSH??????? 02H
DELAY3: DJNZ??????? R2,DELAY3
????????????? POP????? 02H
????????????? DJNZ??? R2,DELAY2
????????????? POP????? 02H
????????????? DJNZ??? R2,DELAY1
????????????? POP????? 02H
????????????? DJNZ??? R2,DELAY
????????????? RET
????????????? END
四、實驗步驟
??? ①將DVCC實驗系統(tǒng)上J8插座與鍵盤顯示板用扁平電纜相連。
??? ②將KEY區(qū)D0—D7用8芯排線連到BUS2區(qū)XD0—XD7上。
??? ③將KEY區(qū)WR、RD、ALE分別連到BUS3區(qū)XWR、XRD、ALE上。
??? ④KEY區(qū)A0連到BUS1區(qū)XA0上。
??? ⑤KEY區(qū)RST連到MP區(qū)SP上。
??? ⑥KEY區(qū)KCS連到SELET區(qū)的Y3上。
??? ⑦在DVCC實驗系統(tǒng)上按F2鍵進入仿真1態(tài),即顯示“P.....”,從起始地址08F0H開始連續(xù)執(zhí)行程序。
⑧功能板上數(shù)碼管顯示P,按下功能板上的數(shù)字鍵,數(shù)碼管上顯示相應的數(shù)字,按下功能鍵,數(shù)碼管上顯示相應的0字循環(huán)(LAST鍵)、1字循環(huán)(NEXT鍵)、2字循環(huán)(EXEC鍵)。
評論
查看更多