1、1、用一个由八段共阴极 LED显示器组成的显示装置和一个外接 CLK=1953Hz的8253定时/计数器,组成一个用于显示 09的秒计数器,并接蜂鸣器。当计时到时触发蜂鸣器。接线图:C5区:CLK0 B2区:1953C5区:OUT0 B4区:PC0B4区:A0、A1、CS A3区:A0、A1、CS1C5区:A0、A1、CS A3区:A0、A1、CS5C5区:GATE0 C1区:VCCG6区:JP80 G5区:JP41G5区:JP42 B4区:JP53计数器 1的 OUT1端(8253 的 13引脚) 蜂鸣器计数器 1的 CLK端(8253 的 15引脚) 计数器 0的 OUT0端(8253 的
2、 10引脚)源程序如下:.MODEL TINYCon_8255 EQU 0F003H ;8255控制口PC_8255 EQU 0F002H ;8255 PC口PB_8255 EQU 0F001H ;8255 PB口PA_8255 EQU 0F000H ;8255 PA口COM_ADDR EQU 0B003HT0_ADDR EQU 0B000HT1_ADDR EQU 0B001H.STACK 100.DATATAB DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH.CODESTART:MOV DX,Con_8255;8255初始化MOV AL,81HOUT D
3、X,ALMOV DX,PA_8255MOV AL, 0FEHOUTDX,AL MOV DX,PC_8255MOV AL,0FFH;OUT DX,AL MOV AL,36H ;8253初始化MOV DX,COM_ADDROUT DX ,ALMOV AX,1953MOV DX,T0_ADDROUT DX,ALMOV AL,AHOUT DX,AL MOV AL,54HMOV DX,COM_ADDROUT DX ,ALMOV AL,10MOV DX,T1_ADDR OUT DX,ALYY:MOV DX,PC_8255IN AL,DXAND AL,01HJNZ YYMOV DX,PB_8255 STAR
4、T1: MOV AL,TABBXOUT DX,ALINC BXCMP BX,10JNZ YYMOV BX,0JMP YYENDSTART2、用一片 8255A控制 1个 8段共阴极 LED数码管,同时接入八个开关。现要求按下某开关,其代表的数字(K0 为 0,K1 为 1,K7 为 7)在数码管上显示,直到按下另一个开关。假定 8255A的口 A、B、C 及控制口的地址依次为 6063H。要求:(1)设计相应的电路图;(2)简要写出分析过程。(3)编写完成上述功能的程序,应包括 8255A的初始化、控制程序和数码管的显示代码表。(1)连线说明:B4区:CS、A0、A1 - A3区:CS1、A0
5、、A1B4区:JP53(PB)、JP52(PC)- G5区:JP42、JP41B4区:JP56(PA) - G6区:JP80(2)程序源代码.MODEL TINYCon_8255 EQU 0F003H ;8255控制口PA_8255 EQU 0F000H ;8255A口PB_8255 EQU 0F001H ;8255B口PC_8255 EQU 0F002H ;8255C口.STACK 100.DATATAB DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH ;0-8及不显示的数据.CODESTART: MOV DX,Con_8255MOV AL,90HOUT DX,
6、AL ;8255初始化,B、C 口用作输出,A 口输入MOV DX,PC_8255 ;WEIXUANMOV AL,00H OUT DX,AL ;选择最低位的一个 LED数码管工作START1: MOV DX,PA_8255IN AL,DX ;将按键的列线数据读入TEST AL,0FFHJE ERRORL0: TEST AL,0FEHJNZ N1MOV AL,1JMP DISPN1: TEST AL,0FDHJNZ N2MOV AL,2JMP DISPN2: TEST AL,0FBHJNZ N3MOV AL,3JMP DISPN3: TEST AL,0F7HJNZ N4MOV AL,4JMP D
7、ISPN4: TEST AL,0EFHJNZ N5MOV AL,5JMP DISPN5: TEST AL,0DFHJNZ N6MOV AL,6JMP DISPN6: TEST AL,0BFHJNZ N7MOV AL,7JMP DISPN7: TEST AL,7FHJNZ ERRORMOV AL,8JMP DISPERROR: MOV AL,0HJMP DISP ;输入错误,则数码管不显示任何数DISP: MOV DX,PB_8255MOV BL,ALMOV BH,00HMOV AL,TABBXOUT DX,ALJMP START1END START3、用一片 8255A控制 1个 8段共阴极
8、LED数码管,同时接入一个 4X4的矩阵键盘。现要求按下某个按键,其代表的数字或字母在数码管上显示,直到按下另一个按键开关。假定8255A的口 A、B、C 及控制口的地址依次为 6063H。要求:(1)设计相应的电路图;(2)简要写出分析过程。(3)编写完成上述功能的程序,应包括 8255A的初始化、控制程序和数码管的显示代码表。(1)连线说明B4区:A0、A1、CS - A3区:A0、A1、CS1B4区:JP56、JP53、JP52 - G5区:JP47、JP92、JP42G5区:JP41 - G6区:JP80(2)程序代码如下:.MODEL TINYCon_8255 EQU 0F003H
9、;8255控制口PC_8255 EQU 0F002H ;8255 PC口PB_8255 EQU 0F001H ;8255 PB口PA_8255 EQU 0F000H ;8255 PA口.STACK 100.CODEDATA1 DB 3FH,7FH,06H,6FH,5BH,77H,4FH,7CH,66H,39H,6DH,5EH,7DH,79H,07H,71HSTART:MOV AL,82H ;控制字:方式 0,PA 输出,PB 输入 MOV DX,Con_8255OUT DX,AL ;设置 8255控制字MOV AL,00H ;使各行线为 0MOV DX,PA_8255OUT DX,ALNN:M
10、OV DX, PB_8255IN AL,DX ;读取列数据AND AL,03H ;屏蔽无关位CMP AL,03H ;各列线有无为 0情况JZ NN ;无为 0列,等待按键BEGIN:MOVBX,0208H ;行数送 BL,列数送 BHMOVCL,0FFH ;起始键号(CL)=-1MOVAL,11111110B ;起始扫描码,0 行=0LOP1:MOVDX,PA_8255 ;扫描一行OUTDX,ALRCL AL,1 ;扫描下一行数据MOV AH,AL ;保存到 AHINC DX ;PB端口地址IN AL,DX ;读 PBANDAL,03H ;屏蔽无关位CMPAL,03H ;本扫描行,有无列线为
11、0JNZ LOP2 ;有,转 LOP2查找本行键号ADDCL,2 ;键号+4(一行 4个键)MOVAL,AH ;恢复下一行扫描码DECBL ;行数-1JNZ LOP1 ;返回扫描下一行JMP BEGINLOP2:INCCL ;键号十 1RCRAL,1 ;循环右移一位JC LOP2 ;最低位为 1,返回查找MOV BX,0MOV BL,CLMOV AL,DATA1BXMOV DX, PC_8255OUT DX,ALJMP BEGINEND START4、用一片 8255A和 8155来驱动 16X16LED显示器显示汉字,并实现在液晶屏上显示滚动的汉字(程序可参照 8088文件夹中的程序 LED
12、16_16.ASM) 。源程序如下:.MODEL TINYADDR_8255_PA EQU 0F000H ;8255 PA口ADDR_8255_PB EQU 0F001H ;8255 PB口ADDR_8255_PC EQU 0F002H ;8255 PC口ADDR_8255_C EQU 0F003H ;8255控制口ADDR_8155_PA EQU 0E101H ;8155 PA口ADDR_8155_PB EQU 0E102H ;8155 PB口ADDR_8155_C EQU 0E100H ;8155控制口LINE1 EQU ADDR_8255_PA ;行线 1LINE2 EQU ADDR_8
13、255_PB ;行线 2ROW1 EQU ADDR_8255_PC ;列线 1ROW2 EQU ADDR_8155_PA ;列线 2.STACK 100.DATANUM DW 11 ;汉字数量SPEED DB 4 ;显示速度(1,2,3,4,越来越快)WAY DB 5 ;显示方向(5 从右到左,6 从左到右,7 从下到上,8 从上到下);从下到上的字模UP_TOU DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H ;空白DB 000H,000H,000H,000H,000H,00
14、0H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000HDB 022H,010H,032H,018H,02AH,090H,04AH,0A0H,0AFH,0BEH,030H,064H,02FH,0A4H,060H,024H;DB 0A7H,0A4H,024H,094H,024H,094H,024H,088H,024H,0D4H,028H,0A4H,030H,046H,020H,084H;“微“,0DB 010H,000H,010H,0F8H,010H,088H,0FEH,088H,010H,088H,010H,088H,038H,088H,034H
15、,088H;DB 054H,088H,050H,088H,091H,008H,011H,00AH,012H,00AH,012H,00AH,014H,006H,010H,000H;“机“,1DB 000H,000H,03FH,0FCH,021H,080H,021H,000H,027H,0F0H,024H,010H,027H,0F0H,024H,010H;DB 024H,010H,027H,0F0H,020H,080H,024H,0A0H,046H,098H,048H,08CH,092H,088H,081H,000H;“原“,2DB 000H,000H,003H,0FCH,0FAH,044H,02
16、2H,044H,023H,0FCH,022H,044H,0FAH,044H,023H,0FCH;DB 022H,044H,020H,040H,023H,0FCH,038H,040H,0C0H,040H,000H,040H,00FH,0FEH,000H,000H;“理“,3DB 000H,000H,008H,000H,008H,004H,00FH,0FEH,008H,000H,008H,000H,00FH,0FCH,000H,004H;DB 000H,004H,000H,024H,07FH,0F4H,000H,004H,000H,004H,000H,048H,000H,030H,000H,000
17、H;“与“,4DB 010H,040H,010H,020H,013H,0FCH,0FDH,008H,010H,090H,017H,0FEH,014H,000H,018H,080H;DB 030H,080H,0DFH,0FEH,011H,010H,013H,010H,010H,0E0H,010H,050H,051H,08CH,026H,004H;“接“,5DB 000H,000H,000H,000H,03FH,0F8H,020H,008H,020H,008H,020H,008H,020H,008H,020H,008H;DB 020H,008H,020H,008H,020H,008H,03FH,0
18、F8H,020H,008H,020H,008H,000H,000H,000H,000H;“口“,6DB 010H,020H,010H,020H,010H,020H,0FDH,0FEH,010H,020H,014H,020H,019H,0FCH,031H,008H;DB 0D0H,088H,010H,090H,010H,060H,010H,060H,010H,090H,011H,00EH,056H,004H,020H,000H;“技“,7DB 001H,000H,001H,020H,001H,010H,001H,000H,0FFH,0FEH,001H,000H,003H,080H,005H,04
19、0H;DB 005H,020H,009H,010H,011H,018H,021H,00EH,0C1H,004H,001H,000H,001H,000H,000H,000H;“术“,8DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H ;空白DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H;从上到下的字模DB 000H,000H,000H,000H,000H,000H,
20、000H,000H,000H,000H,000H,000H,000H,000H,000H,000H ;空白DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000HDB 000H,080H,0F8H,040H,08FH,0FEH,094H,004H,0A0H,000H,0A3H,0F8H,090H,000H,088H,000H;DB 08FH,0FEH,0A9H,020H,091H,020H,081H,020H,082H,022H,082H,022H,084H,022H,088H,01EH
21、;“院“,8DB 001H,008H,010H,08CH,00CH,0C8H,008H,090H,07FH,0FEH,040H,004H,08FH,0E8H,000H,040H;DB 000H,080H,07FH,0FEH,000H,080H,000H,080H,000H,080H,000H,080H,002H,080H,001H,000H;“学“,7DB 000H,000H,03FH,0FCH,001H,000H,001H,000H,001H,000H,001H,000H,001H,000H,001H,000H;DB 001H,000H,001H,000H,001H,000H,001H,00
22、0H,001H,000H,0FFH,0FEH,000H,000H,000H,000H;“工“,6DB 001H,008H,010H,08CH,00CH,0C8H,008H,090H,07FH,0FEH,040H,004H,08FH,0E8H,000H,040H;DB 000H,080H,07FH,0FEH,000H,080H,000H,080H,000H,080H,000H,080H,002H,080H,001H,000H;“学“,5DB 001H,000H,001H,000H,001H,000H,001H,000H,001H,000H,0FFH,0FEH,001H,000H,002H,080
23、H;DB 002H,080H,002H,040H,004H,040H,004H,020H,008H,010H,010H,018H,020H,00EH,040H,004H;“大“,4DB 004H,040H,004H,040H,004H,040H,004H,044H,044H,046H,024H,04CH,024H,048H,014H,050H;DB 01CH,050H,014H,060H,004H,040H,004H,040H,004H,044H,0FFH,0FEH,000H,000H,000H,000H;“业“,3DB 002H,000H,003H,000H,002H,004H,03FH,0
24、FEH,022H,004H,045H,008H,005H,010H,00CH,0B8H;DB 018H,0A0H,028H,040H,048H,020H,088H,030H,009H,018H,00AH,00EH,01CH,008H,008H,000H;“农“,2DB 010H,004H,010H,084H,010H,084H,010H,084H,010H,084H,010H,084H,010H,084H,010H,084H;DB 010H,084H,010H,084H,010H,084H,010H,084H,010H,084H,020H,084H,020H,004H,040H,000H;“川
25、“,1DB 000H,000H,07FH,0FCH,044H,084H,044H,084H,044H,084H,044H,084H,044H,084H,044H,084H;DB 048H,084H,048H,07CH,050H,004H,060H,004H,040H,004H,07FH,0FCH,040H,004H,000H,000H;“四“,0DOWN_TOU DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H ;空白DB 000H,000H,000H,000H,000H,000
26、H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H;从右到左的字模LEFT_UP DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H ;空白(上半部分)DB 000H,004H,018H,010H,011H,017H,0F8H,056H,011H,010H,011H,013H,015H,038H,010H,000H; ;农(上半部分)DB 000H,008H,006H,001H,000H,0FFH,000H,000H,000H,0
27、FFH,000H,001H,006H,01CH,008H,000H ;业上半部分)DB 000H,000H,01FH,012H,012H,012H,012H,0FFH,012H,012H,012H,012H,01FH,000H,000H,000H ;电上半部分)DB 000H,004H,008H,031H,0E5H,025H,025H,025H,025H,025H,025H,025H,024H,020H,020H,000H ;气上半部分)DB 001H,002H,004H,01FH,0E0H,040H,000H,000H,0FFH,003H,006H,00CH,038H,010H,000H,0
28、00H ;化上半部分)DB 000H,000H,000H,000H,07EH,012H,012H,012H,012H,012H,012H,012H,012H,033H,010H,000H ;与上半部分)DB 000H,000H,000H,01FH,012H,012H,032H,0D2H,052H,012H,012H,012H,01FH,000H,000H,000H ;自上半部分)DB 004H,024H,024H,027H,024H,024H,024H,004H,008H,008H,0FFH,008H,008H,00FH,000H,000H ;动上半部分)DB 001H,002H,004H,0
29、1FH,0E0H,040H,000H,000H,0FFH,003H,006H,00CH,038H,010H,000H,000H ;化(上半部分)DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H ;空白(上半部分);LEFT_DOWNDB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H ;空白(下半部分)DB 010H,020H,040H,082H,0FFH,002H,0
30、04H,008H,080H,040H,0B0H,018H,00EH,004H,004H,000H ;农下半部分)DB 004H,004H,004H,0C4H,084H,0FCH,004H,004H,004H,0FCH,044H,084H,004H,00CH,004H,000H ;业下半部分)DB 000H,000H,0F0H,020H,020H,020H,020H,0FCH,022H,022H,022H,022H,0F2H,002H,00EH,000H ;电下半部分)DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,0F0H,0
31、0CH,002H,00FH,000H ;气下半部分)DB 000H,000H,000H,0FEH,000H,020H,040H,080H,0FCH,002H,002H,002H,002H,01EH,000H,000H ;化下半部分)DB 000H,020H,020H,020H,020H,020H,020H,020H,020H,024H,062H,022H,004H,0F8H,000H,000H ;与下半部分)DB 000H,000H,000H,0FFH,022H,022H,022H,022H,022H,022H,022H,022H,0FFH,000H,000H,000H ;自下半部分)DB 0
32、10H,038H,0D0H,010H,030H,0A0H,072H,024H,008H,030H,0C0H,004H,002H,0FCH,000H,000H ;动下半部分)DB 000H,000H,000H,0FEH,000H,020H,040H,080H,0FCH,002H,002H,002H,002H,01EH,000H,000H ;化(下半部分)DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H ;空白(下半部分);从左到右的字模.CODESTART: MOVAX,DATAM
33、OVDS,AXMOVES,AXNOPCALL INIT_IO ;初始化程序CALL TEST_LED;测试,LED 全亮CALL DL100ms ;延迟,保持全亮CALL CLEAR ;全暗;根据滚动方向的不同调用不同的子程序CMP_SHOW: CALL CLEAR;MOV WAY_CHG,0CMP_6: CMPWAY,6;从左到右显示JNZCMP_7CALL SHOW_RIGHTCMP_7: CMPWAY,7;从下到上显示JNZCMP_8CALL SHOW_UPCMP_8: CMPWAY,8;从上到下显示JNZCMP_5CALL SHOW_DOWNCMP_5: CMPWAY,5JNZCMP_
34、6CALL SHOW_LEFT;从右到左显示JMPCMP_6;从右到左显示子程序SHOW_LEFT PROC NEARMOVCX,NUM ;CX中存放要显示的汉字数量LEASI,LEFT_UPLEFT_1: PUSH CXMOVCX,16;CX中存放每次要显示的行(列)数LEFT_2: CALL DISP_LEFT;调用显示子程序INCSI;SI每次自减一个字节,实现移动效果LOOP LEFT_2;循环 16次之后,汉字数减一POPCXLOOP_LEFT_1: LOOP LEFT_1RETSHOW_LEFT ENDP;从右到左显示子程序的子程序DISP_LEFT PROC NEARPUSH C
35、XMOVCX,8DISP_LEFT_1: CALL DISP_HENG;调用横向显示子程序CMPWAY,5JZ LEFT_LOOPMOVAX,0MOVSS,AXJMPCMP_SHOWLEFT_LOOP:LOOP DISP_LEFT_1;循环显示 8次,降低闪烁POPCXRETDISP_LEFT ENDP;从左到右显示子程序SHOW_RIGHTPROC NEARMOVCX,NUMLEASI,RIGHT_UPRIGHT_1: PUSH CXMOVCX,16RIGHT_2: CALL DISP_RIGHTDECSILOOP RIGHT_2POPCXLOOP_RIGHT_1: LOOP RIGHT_1
36、RETSHOW_RIGHTENDP;从左到右显示子程序的子程序DISP_RIGHTPROC NEARPUSH CXMOVCX,8DISP_RIGHT_1: CALL DISP_HENGCMPWAY,6JZ RIGHT_LOOPMOVAX,0MOVSS,AXJMPCMP_SHOWRIGHT_LOOP: LOOP DISP_RIGHT_1POPCXRETDISP_RIGHTENDP;从下到上显示子程序SHOW_UP PROC NEARMOVCX,NUMLEASI,UP_TOUUP_1: PUSH CXMOVCX,16UP_2: CALL DISP_UPINCSIINCSILOOP UP_2POPC
37、XLOOP_UP_1:LOOP UP_1RETSHOW_UP ENDP;从下到上显示子程序的子程序DISP_UP PROC NEARPUSH CXMOVCX,8DISP_UP_1:CALL DISP_D_UP;调用纵向显示子程序CMPWAY,7JZ UP_LOOPMOVAX,0MOVSS,AX JMPCMP_SHOWUP_LOOP: LOOP DISP_UP_1POPCXRETDISP_UP ENDP;从上到下显示子程序SHOW_DOWN PROC NEARMOVCX,NUMLEASI,DOWN_TOUDOWN_1: PUSH CXMOVCX,16DOWN_2: CALL DISP_DOWND
38、ECSIDECSILOOP DOWN_2POPCXLOOP_DOWN_1: LOOP DOWN_1RETSHOW_DOWN ENDP;从上到下显示子程序的子程序DISP_DOWN PROC NEARPUSH CXMOVCX,8DISP_DOWN_1: CALL DISP_D_UP;调用纵向显示子程序CMPWAY,8JZ DOWN_LOOPMOVAX,0MOVSS,AXJMPCMP_SHOWDOWN_LOOP:LOOP DISP_DOWN_1POPCXRETDISP_DOWN ENDP;横向显示子程序DISP_HENG PROC NEARPUSH SIPUSH CXMOVCX,16MOVBL,0
39、80HMOVBH,000HREPEAT_R_UP: LODSBCALL ADJUSTMOVDX,LINE1NOTALOUTDX,AL ;上边列输出PUSH SI ;保存地址;MOV AX,NUM;MOV DX,16;MUL AX,DXADDSI,175LODSBCALL ADJUSTMOVDX,LINE2NOTALOUTDX,AL ;下边列输出POPSIMOVDX,ROW1MOVAL,BLOUTDX,AL ;左边行输出MOVDX,ROW2MOVAL,BHOUTDX,AL ;右边行输出CALL DELAY_TIMECALL CLEARCLCRCRBL,1RCRBH,1LOOP REPEAT_R_
40、UPPOPCXPOPSICALL SCAN_KEYRETDISP_HENG ENDP;纵向显示子程序DISP_D_UP PROC NEARPUSH SIPUSH CXMOVCX,16;计数器,16 列依次被扫描MOVBL,0FEH ;上边列输出值MOVBH,0FFH ;下边列输出值REPEAT_D_UP: MOVDX,LINE1MOVAL,BLOUTDX,AL ;上边列输出MOVDX,LINE2MOVAL,BHOUTDX,AL ;下边列输出LODSBMOVDX,ROW1OUTDX,AL ;左边行输出LODSBMOVDX,ROW2OUTDX,AL ;右边行输出CALL DELAY_TIMECAL
41、L CLEARSTCRCLBL,1RCLBH,1;循环移位 BX,行线扫描输出 0LOOP REPEAT_D_UPPOPCXPOPSICALL SCAN_KEYRETDISP_D_UP ENDPINIT_IO PROC NEARMOV DX,ADDR_8255_C;8255控制字地址MOV AL,80H;设置 8255的 PA、PB、PC 口为输出口OUT DX,AL ;写控制字MOV DX,ADDR_8155_C;8155控制字地址MOV AL,01H;设置 8155的 PA口为输出,PB 为输入OUT DX,AL ;写控制字RETINIT_IO ENDPCLEAR PROC NEARMOV
42、AL,0MOVDX,LINE1OUTDX,ALMOVDX,LINE2OUTDX,ALMOVAL,0MOVDX,ROW1OUTDX,ALMOVDX,ROW2OUTDX,ALRETCLEAR ENDP;调整 AL中取到的字型码的一个字节,将最高位调整位最低位,最低位调整为最高位ADJUST PROC NEARPUSH CXMOVCX,8ADJUST1: RCLAL,1XCHG AL,AHRCRAL,1XCHG AL,AHLOOP ADJUST1MOVAL,AHPOPCXRETADJUST ENDP;按键测试子程序SCAN_KEY PROC NEARMOVDX,ADDR_8155_PBIN AL,D
43、X ;读取按键CALL DL10ms;延迟 20ms消除抖动CALL DL10ms;JMP SPEED_TESTWAY_TEST: MOVBL,ALANDBL,0F0HCMPBL,0JZ SPEED_TEST;没有按键,不再比较方向WAY_TEST_5: CMPBL,010HJNZWAY_TEST_6MOVWAY,5JMPSPEED_TESTWAY_TEST_6: CMPBL,020H JNZWAY_TEST_7MOVWAY,6JMPSPEED_TESTWAY_TEST_7: CMPBL,040HJNZWAY_TEST_8MOVWAY,7JMPSPEED_TESTWAY_TEST_8: CMP
44、BL,080HJNZSPEED_TEST;可能超过一个按键,认为出错,不改变MOVWAY,8;JMP TEST_ENDSPEED_TEST: MOVBL,ALANDBL,00FHCMPBL,0JZ TEST_ENDSPEED_TEST_1: CMPBL,01HJNZSPEED_TEST_2MOVSPEED,1JMPTEST_ENDSPEED_TEST_2: CMPBL,02HJNZSPEED_TEST_3MOVSPEED,2JMPTEST_ENDSPEED_TEST_3: CMPBL,04HJNZSPEED_TEST_4MOVSPEED,3JMPTEST_ENDSPEED_TEST_4: CM
45、PBL,08HJNZTEST_ENDMOVSPEED,4TEST_END: RETSCAN_KEY ENDP;延时调用子程序DELAY_TIMEPROC NEARCMPSPEED,1JZ DELAY500CMPSPEED,2JZ DELAY100CMPSPEED,3JZ DELAY10CMPSPEED,4JZ DELAY3JMPDELAY10DELAY500: CALL DL10msDELAY100: CALL DL10msDELAY10: CALL DL3msDELAY3: CALL DL1msRETDELAY_TIMEENDPTEST_LED PROC NEARMOVDX,LINE1XOR
46、AL,ALOUTDX,ALMOVDX,LINE2OUTDX,ALMOVAL,0FFHMOVDX,ROW1OUTDX,ALMOVDX,ROW2OUTDX,ALRETTEST_LED ENDPDL1ms PROC NEARPUSH CXMOVCX,13LOOP $POPCXRETDL1ms ENDPDL3ms PROC NEARPUSH CXMOVCX,33LOOP $POPCXRETDL3ms ENDPDL10ms PROC NEARPUSH CXMOVCX,133LOOP $POPCX RETDL10ms ENDPDL100ms PROC NEARPUSH CXMOVCX,03FFFHLOOP $POPCXRETDL100ms ENDPDL500ms PROC NEARPUSH CXMOVCX,0FFFFHLOOP $POPCXRETDL500ms ENDPENDSTART