forked from lldavuull/PWM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PWM.h
95 lines (87 loc) · 5.02 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* File:
* Author:
* Comments:
* Revision history:
*/
#include <stdint.h>
volatile int i = 0;
typedef union {
unsigned int DC;
struct{
unsigned DCL :8;
unsigned DCH :8;
};
}PWM_16;
const PWM_16 PWM[]={
0x0000, 0x00C8, 0x00CC, 0x00D1, 0x00D6, 0x00DB, 0x00E1, 0x00E6, 0x00EC, 0x00F1, //9
0x00F7, 0x00FD, 0x0103, 0x0109, 0x0110, 0x0116, 0x011D, 0x0124, 0x012B, 0x0132, //19
0x0139, 0x0141, 0x0149, 0x0151, 0x0159, 0x0161, 0x016A, 0x0172, 0x017B, 0x0184, //29
0x018E, 0x0197, 0x01A1, 0x01AB, 0x01B5, 0x01C0, 0x01CB, 0x01D6, 0x01E1, 0x01EC, //39
0x01F8, 0x0204, 0x0211, 0x021E, 0x022B, 0x0238, 0x0246, 0x0254, 0x0262, 0x0270, //49
0x0280, 0x028F, 0x029F, 0x02AF, 0x02BF, 0x02D0, 0x02E1, 0x02F3, 0x0305, 0x0318, //59
0x032B, 0x033E, 0x0352, 0x0367, 0x037C, 0x0391, 0x03A7, 0x03BE, 0x03D5, 0x03EC, //69
0x0404, 0x041D, 0x0436, 0x0450, 0x046B, 0x0486, 0x04A2, 0x04BE, 0x04DC, 0x04F9, //79
0x0518, 0x0537, 0x0557, 0x0578, 0x059A, 0x05BC, 0x05E0, 0x0604, 0x0629, 0x064F, //89
0x0676, 0x069D, 0x06C6, 0x06F0, 0x071A, 0x0746, 0x0773, 0x07A1, 0x07CF, 0x0800, //99
0x0831, 0x0863, 0x0897, 0x08CB, 0x0902, 0x0939, 0x0972, 0x09AC, 0x09E7, 0x0A24, //109
0x0A63, 0x0AA2, 0x0AE4, 0x0B27, 0x0B6B, 0x0BB2, 0x0BFA, 0x0C43, 0x0C8F, 0x0CDC, //119
0x0D2B, 0x0D7C, 0x0DCF, 0x0E24, 0x0E7B, 0x0ED4, 0x0F2F, 0x0F8C, 0x0FEC, 0x104E, //129
0x10B2, 0x1119, 0x1182, 0x11EE, 0x125C, 0x12CD, 0x1341, 0x13B7, 0x1430, 0x14AC, //139
0x152C, 0x15AE, 0x1633, 0x16BC, 0x1747, 0x17D7, 0x1869, 0x18FF, 0x1999, 0x1A37, //149
0x1AD8, 0x1B7D, 0x1C26, 0x1CD3, 0x1D84, 0x1E3A, 0x1EF4, 0x1FB2, 0x2075, 0x213D, //159
0x2209, 0x22DA, 0x23B1, 0x248C, 0x256D, 0x2653, 0x273F, 0x2830, 0x2927, 0x2A24, //169
0x2B28, 0x2C31, 0x2D41, 0x2E57, 0x2F74, 0x3098, 0x31C3, 0x32F5, 0x342E, 0x356F, //179
0x36B7, 0x3808, 0x3961, 0x3AC1, 0x3C2B, 0x3D9D, 0x3F18, 0x409C, 0x4229, 0x43C0, //189
0x4561, 0x470B, 0x48C0, 0x4A7F, 0x4C4A, 0x4E1F, 0x4FFF, 0x51EB, 0x53E3, 0x55E7, //199
0x57F7, 0x5A14, 0x5C3E, 0x5E75, 0x60BA, 0x630D, 0x656E, 0x67DE, 0x6A5D, 0x6CEB, //209
0x6F88, 0x7236, 0x74F5, 0x77C4, 0x7AA5, 0x7D97, 0x809B, 0x83B2, 0x86DC, 0x8A19, //219
0x8D6A, 0x90D0, 0x944B, 0x97DB, 0x9B80, 0x9F3D, 0xA310, 0xA6FB, 0xAAFE, 0xAF19, //229
0xB34E, 0xB79D, 0xBC06, 0xC08A, 0xC52A, 0xC9E7, 0xCEC0, 0xD3B8, 0xD8CE, 0xDE03, //239
0xE358, 0xE8CE, 0xEE66, 0xF420, 0xF9FD, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, //249
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
};
//char* PWM_ptr=&Inter_PWM_16;
volatile char *PWMDCLptr[4];
volatile char *PWMDCHptr[4];
//volatile char *PWMDCptr[4];
volatile char *PWMLDCONptr[4];
//#define PWMDCH[0] PWM1DCH
//#define PWMDCL[0] PWM1DCH
//#define PWMDCH[1] PWM2DCH
//#define PWMDCL[1] PWM2DCH
//#define PWMDCH[2] PWM3DCH
//#define PWMDCL[2] PWM3DCH
//#define PWMDCH[3] PWM4DCH
//#define PWMDCL[3] PWM4DCH
//
//#define PWMLDCON[0]=PWM1LDCON
//#define PWMLDCON[1]=PWM2LDCON
//#define PWMLDCON[2]=PWM3LDCON
//#define PWMLDCON[3]=PWM4LDCON
//0x0000, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0046, 0x0048, 0x0048, 0x0048,
// 0x0048, 0x0049, 0x0049, 0x0049, 0x004A, 0x004A, 0x004C, 0x004D, 0x004D, 0x004E,
// 0x0050, 0x0052, 0x0053, 0x0054, 0x0056, 0x0058, 0x005A, 0x005C, 0x005E, 0x0060,
// 0x0062, 0x0064, 0x0067, 0x006A, 0x006C, 0x006F, 0x0072, 0x0076, 0x007A, 0x007C,
// 0x0080, 0x0083, 0x0088, 0x008A, 0x008E, 0x0092, 0x0098, 0x009E, 0x00A4, 0x00AC,
// 0x00B4, 0x00BC, 0x00C0, 0x00C8, 0x00D0, 0x00DE, 0x00E4, 0x00EC, 0x00F6, 0x0106,
// 0x010E, 0x0116, 0x011E, 0x012C, 0x0134, 0x013C, 0x0146, 0x0156, 0x0160, 0x0168,
// 0x0176, 0x0182, 0x018A, 0x0196, 0x01A6, 0x01B2, 0x01BE, 0x01CC, 0x01D8, 0x01E4,
// 0x01F6, 0x0202, 0x020E, 0x0220, 0x0230, 0x0240, 0x024C, 0x0262, 0x0270, 0x0280,
// 0x0292, 0x02A2, 0x02B6, 0x02C6, 0x02D6, 0x02EA, 0x0300, 0x031C, 0x0326, 0x0336,
// 0x0348, 0x0360, 0x0376, 0x0386, 0x039E, 0x03B0, 0x03C8, 0x03DC, 0x03F4, 0x0406,
// 0x041C, 0x043A, 0x044C, 0x0468, 0x047E, 0x0496, 0x04B2, 0x04C8, 0x04E0, 0x04F8,
// 0x0514, 0x0530, 0x054C, 0x0566, 0x0580, 0x059C, 0x05B8, 0x05D8, 0x05F4, 0x060E,
// 0x0628, 0x0648, 0x0668, 0x0688, 0x06A4, 0x06C4, 0x06DC, 0x0704, 0x0724, 0x0740,
// 0x0764, 0x0784, 0x07A4, 0x07C8, 0x07EC, 0x0810, 0x0830, 0x0850, 0x0870, 0x0898,
// 0x08C0, 0x08E8, 0x0908, 0x0930, 0x0958, 0x0980, 0x09A0, 0x09C8, 0x09F0, 0x0A18,
// 0x0A40, 0x0A68, 0x0A94, 0x0ABC, 0x0AE4, 0x0B10, 0x0B38, 0x0B60, 0x0B8C, 0x0BB4,
// 0x0BE8, 0x0C16, 0x0C40, 0x0C6C, 0x0C98, 0x0CCC, 0x0CFC, 0x0D28, 0x0D58, 0x0D88,
// 0x0DB8, 0x0DE8, 0x0E18, 0x0E48, 0x0E78, 0x0EA8, 0x0EE0, 0x0F10, 0x0F48, 0x0F7C,
// 0x0FB0, 0x0FE4, 0x1018, 0x1050, 0x1088, 0x10BC, 0x10F4, 0x112C, 0x1164, 0x1198,//200
// 0x11D0, 0x120C, 0x1244, 0x127C, 0x12B4, 0x12F0, 0x1328, 0x136C, 0x13A8, 0x13E4,
// 0x1420, 0x145C, 0x149C, 0x14DC, 0x1518, 0x1558, 0x159C, 0x15DC, 0x161C, 0x165C,
// 0x169C, 0x16E0, 0x1728, 0x1768, 0x17A8, 0x17F0, 0x1838, 0x1878, 0x18C0, 0x1904,
// 0x1948, 0x1998, 0x19E0, 0x1A28, 0x1A70, 0x1AB8, 0x1B00, 0x1B48, 0x1B90, 0x1BE0,
// 0x1C30, 0x1C80, 0x1CC8, 0x1D18, 0x1D68, 0x1D80, 0x1DB8, 0x1E08, 0x1E50, 0x1EA0,
// 0x1EE8, 0x1F30, 0x1F78, 0x1FC0, 0x1FE8, 0x1FFF