做一个存档。实验要求与电路连接见参考指导书(微机与接口技术实验实验指导书,李颖)P54。
1、主程序产生锯齿波
2、按下KK1+输出五个周期的三角波,继续输出被中断的锯齿波
3、按下KK2+输出五个周期的方波,继续输出被中断的锯齿波
程序代码
IOY0 EQU 0600H
DA EQU IOT0+00H*2
SSTACK SEGMENT STACK
DW 32 DUP(?)
SSTACK ENDS
CODE SEGMENT
ASSUME CS:CODE
START: PUSH DS
MOV AX,0000H
MOV DS,AX
MOV AX,OFFSET MIR7
MOV SI,003CH
MOV [SI],AX
MOV AX,CS
MOV SI,003EH
MOV [SI],AX
MOV AX,OFFSET MIR6
MOV SI,0038H
MOV [SI],AX
MOV AX,CS
MOV SI,003AH
MOV [SI],AX
CLI
POP DS
;初始化主片8259
MOV AL,11H
OUT 20H,AL
MOV AL,08H
OUT 21H,AL
MOV AL,04H
OUT 21H,AL
MOV AL,01H
OUT 21H,AL
MOV AL,2FH
OUT 21H,AL
STI
MOV AX,00H
MOV DX,DA
MOV AL,00H
A0: OUT DX,AL
CALL DELAY
INC AL
JMP A0
MIR6: PUSH AX
PUSH CX
STI
CALL DELAY
MOV CX,5
A1: MOV AL,00H
LOOP1: OUT DX,AL
CALL DELAY
INC AL
CMP AL,0FFH
JB LOOP1
MOV AL,0FFH
MOV DX,DA
LOOP2: OUT DX,AL
CALL DELAY
DEC AL
CMP AL,0
JA LOOP2
LOOP A1
POP CX
POP AX
MOV AL,20H
MOV 20H,AL
IRET
MIR7: PUSH AX
PUSH CX
STI
CALL DELAY
MOV CX,5
A2: MOV AL,00H
OUT DX,DA
CALL DELAY1
MOV AL,7FH
OUT DX,AL
CALL DELAY1
LOOP A2
POP CX
POP AX
MOV AL,20H
MOV 20H,AL
IRET
DELAY: PUSH CX
MOV CX,03FFH
AA0: PUSH AX
POP AX
LOOP AA0
POP CX
RET
DELAY1: PUSH CX
MOV CX,0FF00H
AA1: PUSH AX
POP AX
LOOP AA1
POP CX
RET
CODE ENDS
END START