📄 svm.lst
字号:
C166 COMPILER V4.27, SVM 12/19/2003 11:51:12 PAGE 1
C166 COMPILER V4.27, COMPILATION OF MODULE SVM
OBJECT MODULE PLACED IN SVM.OBJ
COMPILER INVOKED BY: C:\Program Files\Keil\C166\BIN\C166.EXE SVM.C MODV2 BROWSE MODV2 DEBUG
stmt lvl source
1 #include "MAIN.H"
2 #include "DEF.H"
3 #include "TableQ15.h"
4
5 unsigned int tk,tk1,to;
6
7 const int PulseMin_Div2 = 15;
8
9 //****************************************************************************
10 // @Function void SVM (TComplex *m, char *Sector)
11 //
12 //----------------------------------------------------------------------------
13 // @Description This Function calculate the compare values t0, tk and tk+1
14 // for the SVM. Then this values are written in the Shadow-
15 // Registers of CC6-Unit
16 //
17 // Execution time 4.2us @ 40MHz
18 //
19 //----------------------------------------------------------------------------
20 // @Returnvalue None
21 //
22 //----------------------------------------------------------------------------
23 // @Parameters None
24 //
25 //----------------------------------------------------------------------------
26 // @Date 15.10.2003
27 //
28 //****************************************************************************
29 void SVM(TComplex *m, char *Sector)
30 {
31 1 int x;
32 1 bit Abort=1;
33 1
34 1 // determiination of the sector
35 1 x=((long)m->imag*(long)SQRT3INV) >> 15;
36 1 if (m->imag>0)
37 1 { // m.imag>0
38 2 if (m->real>0)
39 2 { // Quadrant 1
40 3 if (x<m->real) {*Sector=0;} else {*Sector=1;}
41 3 }
42 2 else
43 2 { // Quadrant 2
44 3 if (x< -m->real) {*Sector=2;} else {*Sector=1;}
45 3 }
46 2 }
47 1 else
48 1 { // m.imag<0
49 2 if (m->real<0)
50 2 { // Quadrant 3
51 3 if (x<m->real) {*Sector=4;} else {*Sector=3;}
52 3 }
53 2 else
54 2 { // Quadrant 4
55 3 if (x< -m->real) {*Sector=4;} else {*Sector=5;}
C166 COMPILER V4.27, SVM 12/19/2003 11:51:12 PAGE 2
56 3 }
57 2 }
58 1 // Sector contain the Sector number minus 1 (from 0 to 5)
59 1 // Calul of Tk and Tk+1
60 1 // Tk= sin(k)*m.Re - Cos(k)*m.Im k is the sector number
61 1 // Tk+1= Cos(k-1)*m.Im - Sin(k-1)*m.Re
62 1
63 1 tk1 = ((long)CosVectorQ1_15[*Sector]*(long)m->imag - (long)SinVectorQ1_15[*Sector]*(long)m->real) >> 15;
64 1 tk1 = ((long)tk1 * (long)TPWM) >> 15;
65 1
66 1 tk = ((long)SinVectorQ1_15[*Sector+1]*(long)m->real - (long)CosVectorQ1_15[*Sector+1]*(long)m->imag) >> 1
-5;
67 1 tk = ((long)tk * (long)TPWM) >> 15;
68 1
69 1 // lengthen the states to measure the currents
70 1 /*
71 1 if (tk<PulseMin_Div2)
72 1 {
73 1 tk=PulseMin_Div2;
74 1 }
75 1 if (tk1<PulseMin_Div2)
76 1 {
77 1 tk1=PulseMin_Div2;
78 1 }
79 1 */
80 1
81 1 to=1001-tk-tk1;
82 1
83 1 // Write t0, 1k and tk1 to the shadow registers of CC6
84 1 // Set Timer 13 Event Control, for ADC start
85 1 switch (*Sector)
86 1 {
87 2 case 0:
88 2 CCU6_TCTR2 = 0x006A;
89 2 CCU6_CC60SR=to>>2;
90 2 CCU6_CC61SR=500-(to>>2)-(tk1>>1);
91 2 CCU6_CC62SR=500-(to>>2);
92 2 break;
93 2 case 1:
94 2 CCU6_TCTR2 = 0x0066;
95 2 CCU6_CC60SR=(to>>2)+(tk1>>1);
96 2 CCU6_CC61SR=to>>2;
97 2 CCU6_CC62SR=500-(to>>2);
98 2 break;
99 2 case 2:
100 2 CCU6_TCTR2 = 0x006E;
101 2 CCU6_CC60SR=500-(to>>2);
102 2 CCU6_CC61SR=to>>2;
103 2 CCU6_CC62SR=500-(to>>2)-(tk1>>1);
104 2 break;
105 2 case 3:
106 2 CCU6_TCTR2 = 0x006A;
107 2 CCU6_CC60SR=500-(to>>2);
108 2 CCU6_CC61SR=(to>>2)+(tk1>>1);
109 2 CCU6_CC62SR=to>>2;
110 2 break;
111 2 case 4:
112 2 CCU6_TCTR2 = 0x0066;
113 2 CCU6_CC60SR=500-(to>>2)-(tk1>>1);
114 2 CCU6_CC61SR=500-(to>>2);
115 2 CCU6_CC62SR=to>>2;
116 2 break;
C166 COMPILER V4.27, SVM 12/19/2003 11:51:12 PAGE 3
117 2 case 5:
118 2 CCU6_TCTR2 = 0x006E;
119 2 CCU6_CC60SR=(to>>2);
120 2 CCU6_CC61SR=500-(to>>2);
121 2 CCU6_CC62SR=(to>>2)+(tk1>>1);
122 2 break;
123 2 }
124 1
125 1 }
126
127
MODULE INFORMATION: INITIALIZED UNINITIALIZED
CODE SIZE = 604 --------
NEAR-CONST SIZE = 2 --------
FAR-CONST SIZE = -------- --------
HUGE-CONST SIZE = -------- --------
XHUGE-CONST SIZE = -------- --------
NEAR-DATA SIZE = 6 --------
FAR-DATA SIZE = -------- --------
XHUGE-DATA SIZE = -------- --------
IDATA-DATA SIZE = -------- --------
SDATA-DATA SIZE = -------- --------
BDATA-DATA SIZE = -------- --------
HUGE-DATA SIZE = -------- --------
BIT SIZE = -------- --------
INIT'L SIZE = -------- --------
END OF MODULE INFORMATION.
C166 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -