S3C2440 进行微秒级、毫秒级延时函数(转)(2)
- UID
- 1029342
- 性别
- 男
|
S3C2440 进行微秒级、毫秒级延时函数(转)(2)
1 void T1DelayNus(UINT16 t)
2 {
3 rTCFG1 &=
~(0x0F<<4);
4 rTCFG1 |= (2<<4);
5 rTCNTB1 =(S3C2440PCLK)/8/1000000;
6 rTCON &=
~(0x0F<<8);
7 rTCON |= (1<<11)|(1<<9)|(1<<8);
8 rTCON &=
~(1<<9);
9
10
11
while(t--)
12 {
13
14
while(rTCNTO1!=(rTCNTB1-1));
15
16 }
17
18 rTCON &=
~(1<<8);
19
20 }
21
22
23
void T1DelayNms(UINT16 t)
24 {
25 rTCFG1 &=
~(0x0F<<4);
26 rTCFG1 |= (2<<4);
27 rTCNTB1 =(S3C2440PCLK)/8/1000;
28 rTCON &=
~(0x0F<<8);
29 rTCON |= (1<<11)|(1<<9)|(1<<8);
30 rTCON &=
~(1<<9);
31
32
33
while(t--)
34 {
35
while(rTCNTO1!=(rTCNTB1-1));
36 }
37
38 rTCON &=
~(1<<8);
39
40 } |
|
|
|
|
|