1、产生周期为 1ms的连续方波,并在示波器上显示
DSEG SEGMENT
OUT0 EQU 280H
OUT1 EQU 281H
OUT2 EQU 282H
CTL0 EQU 283H
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG
START:
MOV AX,DSEG
MOV DS,AX
MOV DX,CTL0
MOV AL,00110111B
OUT DX,AL
MOV DX,OUT0
MOV AL,00H
OUT DX,AL
MOV AL,20H
OUT DX,AL
MOV AH,4CH
INT 21H
CSEG ENDS
END START
2、产生周期为 1ms 的连续负脉冲,并在示波器上显示
CLK0-2MHZ 8253CS-280H~283H,GATE0接VCC(正极/电/+);
count=1ms*2MHZ=2000;OUT0接示波器
DSEG SEGMENT
OUT0 EQU 280H
OUT1 EQU 281H
OUT2 EQU 282H
CTL EQU 283H
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG
START:
MOV AX,DSEG
MOV DS,AX
MOV DX,CTL
MOV AL,00110101B
OUT DX,AL
MOV DX,OUT0
MOV AL,00H
OUT DX,AL
MOV AL,20H
OUT DX,AL
MOV AH,4CH
INT 21H
CSEG ENDS
END START
3、接收按键开关产生的信号进行计数, 10 次后结束,并使 LED 亮
cs接280H~287H;GATE0接VCC(正极/电/+);
DSEG SEGMENT
OUT0 EQU 280H
OUT1 EQU 281H
OUT2 EQU 282H
CTL0 EQU 283H
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG
START:
MOV AX,DSEG
MOV DS,AX
MOV DX,CTL0
MOV AL,00010001B
OUT DX,AL
MOV DX,OUT0
MOV AL,09H
OUT DX,AL
MOV AH,4CH
INT 21H
CSEG ENDS
END START
4、产生周期为1s方波,并在LED上显示
;8253cs 280H~283H
;OUT0-CLK1,CLK0-2MHZ,count=1s*2MHZ=2000000=2000*1000
; GATE0-GATE1接VCC(正极/电/+) OUT1 接LED
DSEG SEGMENT
OUT0 EQU 280H
OUT1 EQU 281H
OUT2 EQU 282H
CTL EQU 283H
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG
START:
MOV AX,DSEG
MOV DS,AX
MOV DX,CTL
MOV AL,00110111B;计数器0,高低位,方式3 方波,BCD
OUT DX,AL
MOV DX,OUT0
MOV AL,00H
OUT DX,AL
MOV AL,20H
OUT DX,AL
MOV DX,CTL
MOV AL,01110111B;计数器1,高低位,方式3 方波,BCD
OUT DX,AL
MOV DX,OUT1
MOV AL,00H
OUT DX,AL
MOV AL,10H
OUT DX,AL
MOV AH,4CH
INT 21H
CSEG ENDS
END START
5、产生周期为 10ms ,负脉冲宽度为 100us 的连续脉冲
cs接280H~287H;GATE0、GATE1接VCC(正极/电/+);
DSEG SEGMENT
OUT0 EQU 280H
OUT1 EQU 281H
OUT2 EQU 282H
CTL0 EQU 283H
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG
START:
MOV AX,DSEG
MOV DS,AX
MOV DX,CTL0
MOV AL,00100101B
OUT DX,AL
MOV DX,OUT0
MOV AL,02H
OUT DX,AL
MOV DX,CTL0
MOV AL,01100101B
OUT DX,AL
MOV DX,OUT1
MOV AL,01H
OUT DX,AL
MOV AH,4CH
INT 21H
CSEG ENDS
END START
6、产生周期为 10ms , 负脉冲宽度为1 ms的连续脉冲
cs接280H~287H;GATE0、GATE1接VCC(正极/电/+);
DSEG SEGMENT
OUT0 EQU 280H
OUT1 EQU 281H
OUT2 EQU 282H
CTL0 EQU 283H
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG
START:
MOV AX,DSEG
MOV DS,AX
MOV DX,CTL0
MOV AL,00110101B
OUT DX,AL
MOV DX,OUT0
MOV AL,00H
OUT DX,AL
MOV AL,20H
OUT DX,AL
MOV DX,CTL0
MOV AL,01010101B
OUT DX,AL
MOV DX,OUT1
MOV AL,10H
OUT DX,AL
MOV AH,4CH
INT 21H
CSEG ENDS
END START