8254定时计数器应用实验报告 下载本文

.

图2 8254 计数应用实验接线图 实验程序清单 A8254 EQU 06C0H B8254 EQU 06C2H C8254 EQU 06C4H CON8254 EQU 06C6H SSTACK SEGMENT STACK DW 32 DUP(?) SSTACK ENDS CODE SEGMENT ASSUME CS:CODE,SS:SSTACK START: PUSH DS Word 资料

.

MOV AX,0000H MOV DS,AX MOV AX,OFFSET IRQ7 MOV SI,003CH MOV[SI],AX MOV AX,CS MOV SI,003EH MOV [SI],AX CLI POP DS ; MOV AL,11H OUT 20H,AL ;ICW1 MOV AL,08H OUT 21H,AL ;ICW2 MOV AL,04H OUT 21H,AL ;ICW3 MOV AL,01H OUT 21H,AL ;ICW4 MOV AL,6FH ;OCW1 OUT 21H,AL ;8254 Word 资料

.

MOV DX,CON8254 MOV AL,10H OUT DX,AL MOV DX,A8254 MOV AL,04H OUT DX,AL STI AA1: JMP AA1 IRQ7: MOV DX,A8254 MOV AL,04H OUT DX,AL MOV AX,014DH INT 10H MOV AX,0120H INT 10H MOV AL,20H OUT 20H,AL IRET CODE ENDS END START Word 资料

.

运行结果如下: 改变计数值 MOV DX,CON8254 MOV AL,10H OUT DX,AL Word 资料

.

MOV DX,A8254 MOV AL,02H ; (未改动前为MOV AL,04H ) OUT DX,AL STI AA1: JMP AA1 IRQ7: MOV DX,A8254 MOV AL,06H (未改动前为MOV AL,06H) OUT DX,AL MOV AX,014DH INT 10H MOV AX,0120H INT 10H MOV AL,20H OUT 20H,AL IRE 改动后按3次KK1+显示屏上出现第一个M,之后每按动7次KK1+显示一个M. 运行结果如下: Word 资料