- UID
- 852722
|
[DELY]:通用延时子程序
[地址]:7FEBH - FFEBH
[功能]:延时
[入口]:延时常数放在R2寄存器中。时间常数N(十六进制)所对应的延时时间(6MZH晶振时)见下表:
[出口]:R2=0
[占用寄存器]:R2
[调用]:无
例:延时1秒子程序
MOV R2,#18H
LCALL 7FEBH
RET
ORG 7FEBH ;通用延时子程序(07EBH & 0FEBH & ...)
L7FEB: PUSH 02H ;R2(复位后R2即为02H)存放时间常数,进栈保护
L7FED: PUSH 02H ; R2进栈保护
L7FEF: PUSH 02H ; 进栈
L7FF1: DJNZ R2,$ ;R2不为零等待
POP 02H ;出栈
DJNZ R2,L7FEF ; R2不为零转
POP 02H ; 出栈
DJNZ R2,L7FED ; R2不为零转
POP 02H ; 出栈
DJNZ R2,L7FEB ; R2不为零转
RET ;子程序返回
END
N(十六进制数)T(机器周斯)T(秒) 子程序地址
1 11 0.000044
C 2728 0.010912
18 26323 0.105292 2800
1D 50838 0.203352 2808
21 80323 0.321292 2810
24 109666 0.438664 2818
26 133248 0.532992 2820
28 160431 0.641724 2828
29 175481 0.701024 2830
2E 267146 1.068584 2838
37 516836 2.067344 2840
3D 760366 3.041464 2848
42 1021681 4.086724 2850
46 1275016 5.100064 2858
54 2543878 10.175512 2860
65 5144436 20.577744 2868
70 7654053 30.616212 2870
78 9986491 39.945964 2878
7F 12432158 49.728632 2880
98 24956083 99.824332 2888
A9 37708623 150.83453
B6 50353668 201.41467 2890
CA 75697683 302.79073 2898
D9 100218410 400.87365 28A0
E6 125909940 503.63974 28A8
F1 151248830 605.03532 28B0
FF 188839490 755.35794
0 191768000 767.072 28B8 |
|