📄 pmsm.c.bak_smart_update
字号:
#include "Cpu.h"
#include "PWMC.h"
#include "Events.h"
#include "MFR.h"
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
volatile bool updown=0; /* 1 for anticlockwise, 0 for clockwise */
volatile long int cnt2drtchg=0; /* set the frequency of direction change */
volatile int cnt=1; /* set the frequency of speed change */
volatile int cnt2spdadj=1;
volatile unsigned int t1; /* time for vector start */
volatile unsigned int t2; /* time for vector end */
volatile unsigned int large; /* large pwmvalue */
volatile unsigned int middle; /* middle pwmvalue */
volatile unsigned int small; /* small pwmvalue */
volatile int ktemp=0; /* temp for k */
volatile int k; /* set the amplitude of field */
volatile double numn=0; /* set the frequency of rotor speed */
volatile double numf=0;
volatile int num=0;
volatile unsigned int sector=1; /* indicate the sector from 1 to 6 */
volatile int sina[180]=
{
0, 572, 1144, 1715, 2286, 2856, 3425, 3993, 4560,
5126, 5690, 6252, 6813, 7371, 7927, 8481, 9032, 9580,
10126,10668,11207,11743,12275,12803,13328,13848,14365,
14876,15384,15886,16384,16877,17364,17847,18324,18795,
19261,19720,20174,20622,21063,21498,21926,22348,22763,
23170,23571,23965,24351,24730,25102,25466,25822,26170,
26510,26842,27166,27482,27789,28088,28378,28660,28932,
29197,29452,29698,29935,30163,30382,30592,30792,30983,
31164,31336,31499,31651,31795,31928,32052,32166,32270,
32365,32449,32524,32588,32643,32688,32723,32748,32763,
32767,32763,32748,32723,32688,32643,32588,32524,32449,
32365,32270,32166,32052,31928,31795,31651,31499,31336,
31164,30983,30792,30592,30382,30163,29935,29698,29452,
29197,28932,28660,28378,28088,27789,27482,27166,26842,
26510,26170,25822,25466,25102,24730,24351,23965,23571,
23170,22763,22348,21926,21498,21063,20622,20174,19720,
19261,18795,18324,17847,17364,16877,16384,15886,15384,
14876,14365,13848,13328,12803,12275,11743,11207,10668,
10126, 9580, 9032, 8481, 7927, 7371, 6813, 6252, 5690,
5126, 4560, 3993, 3425, 2856, 2286, 1715, 1144, 572
};
volatile int cosa[180]=
{
32767,32763,32748,32723,32688,32643,32588,32524,32449,
32365,32270,32166,32052,31928,31795,31651,31499,31336,
31164,30983,30792,30592,30382,30163,29935,29698,29452,
29197,28932,28660,28378,28088,27789,27482,27166,26842,
26510,26170,25822,25466,25102,24730,24351,23965,23571,
23170,22763,22348,21926,21498,21063,20622,20174,19720,
19261,18795,18324,17847,17364,16877,16384,15886,15384,
14876,14365,13848,13328,12803,12275,11743,11207,10668,
10126, 9580, 9032, 8481, 7927, 7371, 6813, 6252, 5690,
5126, 4560, 3993, 3425, 2856, 2286, 1715, 1144, 572,
0, -572, -1144, -1715, -2286, -2856, -3425,-3993, -4560,
-5126, -5690, -6252, -6813, -7371, -7927, -8481, -9032, -9580,
-10126,-10668,-11207,-11743,-12275,-12803,-13328,-13848,-14365,
-14876,-15384,-15886,-16384,-16877,-17364,-17847,-18324,-18795,
-19261,-19720,-20174,-20622,-21063,-21498,-21926,-22348,-22763,
-23170,-23571,-23965,-24351,-24730,-25102,-25466,-25822,-26170,
-26510,-26842,-27166,-27482,-27789,-28088,-28378,-28660,-28932,
-29197,-29452,-29698,-29935,-30163,-30382,-30592,-30792,-30983,
-31164,-31336,-31499,-31651,-31795,-31928,-32052,-32166,-32270,
-32365,-32449,-32524,-32588,-32643,-32688,-32723,-32748,-32763
};
void main(void)
{
PE_low_level_init();
for(;;) {}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -