非常精确的C语言延时子程序表
非常精确的C语言延时子程序表
void delay(void)
{
unsigned char a,b,c;
for(a=0;a<?;a++)
for(b=0;b<?;b++)
for(c=0;c<?;c++);
}
序号 |
延时时间 |
a的值 |
b的值 |
c的值 |
延时误差(us) |
1 |
10us |
1 |
1 |
1 |
-0.5 |
2 |
20us |
1 |
1 |
8 |
0 |
3 |
30us |
1 |
1 |
15 |
+0.5 |
4 |
40us |
2 |
1 |
9 |
0 |
5 |
50us |
1 |
1 |
28 |
0 |
6 |
60us |
1 |
1 |
35 |
+0.5 |
7 |
70us |
1 |
1 |
42 |
+1 |
8 |
80us |
1 |
1 |
48 |
0 |
9 |
90us |
1 |
1 |
55 |
+0.5 |
10 |
100us |
1 |
1 |
61 |
-0.5 |
11 |
200us |
1 |
1 |
128 |
0 |
12 |
300us |
3 |
1 |
63 |
+0.5 |
13 |
400us |
2 |
1 |
129 |
0 |
14 |
500us |
5 |
1 |
63 |
+0.5 |
15 |
600us |
6 |
1 |
63 |
0 |
16 |
700us |
7 |
1 |
63 |
-0.5 |
17 |
800us |
1 |
3 |
175 |
+0.5 |
18 |
900us |
9 |
1 |
63 |
-1.5 |
19 |
1ms |
1 |
3 |
219 |
-1.5 |
20 |
2ms |
2 |
3 |
220 |
+3 |
21 |
3ms |
3 |
3 |
220 |
+3 |
22 |
Xms |
X |
3 |
220 |
+3 |