ASSUME CS:CODE
START: MOV AL,17 %选择计数器0,低八位有效,工作方式3,BCD码
OUT 03H,AL %选择X00端口,03H端口执行
MOV AL,0.33H %初值是0.33
OUT 00H,AL
CODE ENDS
END START
T=30S=1HZ/0.33
分两步走(假定8253端口地址为40H~43H)计数值1=Tout1/Tclk1=2000000/1000=2000(假定计数器1号,2M时钟输入,输出时钟为1KHz)
计数值2=Tout2/Tclk2=1000*0.5=500(计数器2号输入时钟为1KHz,输出延时0.5s)
初始化程序为:
MOV AL,01110110B
OUT 43H,AL
MOV AX,2000
OUT 41H,AL
MOV AH,AL
OUT 41H,AL
MOV AL,10110110B
OUT 43H,AL
MOV AX,500
OUT 42H,AL
MOV AL,AH
OUT 42H,AL
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)