有用的单片机程序,包括8279和E2ROM的读写
源代码在线查看: 多种延时程序.txt
;以下各延时程序为6M晶振
;-----------------------------------------------------
;功能:延时0.1秒
;----------------------------------------------------
DELAY01:
PUSH 2
PUSH 1
PUSH 0
MOV 2,#01H ;延时0.2s
DELAY011: MOV 1,#00H
DELAY022: MOV 0,#61H ;延时100个ms
DJNZ 0,$
DJNZ 1,DELAY022 ;6M
DJNZ 2,DELAY011
POP 0
POP 1
POP 2
RET
;-----------------------------------------------------
;功能:延时0.2秒
;----------------------------------------------------
DELAY02:
PUSH 2
PUSH 1
PUSH 0
MOV 2,#02H ;延时0.2s
DELAY11: MOV 1,#00H
DELAY22: MOV 0,#61H ;延时100个ms
DJNZ 0,$
DJNZ 1,DELAY22 ;6M
DJNZ 2,DELAY11
POP 0
POP 1
POP 2
RET
;-----------------------------------------------------
;功能:延时0.5秒
;----------------------------------------------------
DELAY05:
PUSH 2
PUSH 1
PUSH 0
MOV 2,#05H ;延时0.5s
DELAY051: MOV 1,#00H
DELAY052: MOV 0,#61H ;延时100个ms
DJNZ 0,$
DJNZ 1,DELAY052 ;6M
DJNZ 2,DELAY051
POP 0
POP 1
POP 2
RET
;-----------------------------------------------------
;功能:延时1秒
;----------------------------------------------------
DELAY10:
PUSH 2
PUSH 1
PUSH 0
MOV 2,#0AH ;延时1s
DELAYY11: MOV 1,#00H
DELAYY22: MOV 0,#61H ;延时100个ms
DJNZ 0,$
DJNZ 1,DELAY22 ;6M
DJNZ 2,DELAY11
POP 0
POP 1
POP 2
RET