-
Notifications
You must be signed in to change notification settings - Fork 1
/
pwm.h
44 lines (26 loc) · 1011 Bytes
/
pwm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef __PWM_H
#define __PWM_H
#define GPD0CON (0xE02000A0)
#define TCFG0 (0xE2500000)
#define TCFG1 (0xE2500004)
#define CON (0xE2500008)
#define TCNTB2 (0xE2500024)
#define TCMPB2 (0xE2500028)
#define TCNTO2 (0xE250002C)
#define rGPD0CON (*(volatile unsigned int *)GPD0CON)
#define rTCFG0 (*(volatile unsigned int *)TCFG0)
#define rTCFG1 (*(volatile unsigned int *)TCFG1)
#define rCON (*(volatile unsigned int *)CON)
#define rTCNTB2 (*(volatile unsigned int *)TCNTB2)
#define rTCMPB2 (*(volatile unsigned int *)TCMPB2)
#define rTCNTO2 (*(volatile unsigned int *)TCNTO2)
//-------------------------------time3----------
#define TCNTB3 (0xE2500030)
#define TCMPB3 (0xE2500034)
#define TCNTO3 (0xE2500038)
#define rTCNTB3 (*(volatile unsigned int *)TCNTB3)
#define rTCMPB3 (*(volatile unsigned int *)TCMPB3)
#define rTCNTO3 (*(volatile unsigned int *)TCNTO3)
// 初始化PWM timer2,使其输出PWM波形:频率是2KHz、duty为50%
void timer2_pwm_init(void);
#endif