一、實(shí)驗(yàn)?zāi)康?br>?? 1、掌握8031系統(tǒng)中,擴(kuò)展8279鍵盤(pán)顯示接口的方法。
2、掌握8279工作原理和編程方法。
二、實(shí)驗(yàn)內(nèi)容
1.實(shí)驗(yàn)原理圖:
?
2、實(shí)驗(yàn)內(nèi)容
???? 在外接的鍵盤(pán)功能板上,按數(shù)字鍵,數(shù)碼管上應(yīng)相應(yīng)能顯示按下的數(shù)字,按下功能鍵,能相應(yīng)執(zhí)行其它功能程序。
3、實(shí)驗(yàn)說(shuō)明
利用8279可以實(shí)現(xiàn)對(duì)鍵盤(pán)/顯示器的自動(dòng)掃描,以減輕CPU負(fù)擔(dān),具有顯示穩(wěn)定,程序簡(jiǎn)單,不會(huì)出現(xiàn)誤動(dòng)作等特點(diǎn)。本實(shí)驗(yàn)利用8279實(shí)現(xiàn)顯示掃描自動(dòng)化。
三、程序
程序清單:
????????????? 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
四、實(shí)驗(yàn)步驟
??? ①將DVCC實(shí)驗(yàn)系統(tǒng)上J8插座與鍵盤(pán)顯示板用扁平電纜相連。
??? ②將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實(shí)驗(yàn)系統(tǒng)上按F2鍵進(jìn)入仿真1態(tài),即顯示“P.....”,從起始地址08F0H開(kāi)始連續(xù)執(zhí)行程序。
⑧功能板上數(shù)碼管顯示P,按下功能板上的數(shù)字鍵,數(shù)碼管上顯示相應(yīng)的數(shù)字,按下功能鍵,數(shù)碼管上顯示相應(yīng)的0字循環(huán)(LAST鍵)、1字循環(huán)(NEXT鍵)、2字循環(huán)(EXEC鍵)。
評(píng)論
查看更多