永发信息网

如何在dsp28335里实现spwm编程,详细步骤

答案:2  悬赏:10  手机版
解决时间 2021-03-24 02:18
  • 提问者网友:最爱你的唇
  • 2021-03-23 10:28
如何在dsp28335里实现spwm编程,详细步骤
最佳答案
  • 五星知识达人网友:轻雾山林
  • 2021-03-23 10:38
开发板例程直接可以调通的
全部回答
  • 1楼网友:底特律间谍
  • 2021-03-23 11:48
采用svpwm,空间矢量调制更简单。 .h 文件 #ifndef __svgen_dq_h__ #define __svgen_dq_h__ typedef struct { float32 ualpha; // input: reference alpha-axis phase voltage float32 ubeta; // input: reference beta-axis phase voltage float32 ta; // output: reference phase-a switching function float32 tb; // output: reference phase-b switching function float32 tc; // output: reference phase-c switching function void (*calc)(); // pointer to calculation function } svgendq; typedef svgendq *svgendq_handle; #define svgendq_defaults { 0,0,0,0,0, \ (void (*)(uint32))svgendq_calc } void svgendq_calc(svgendq_handle); #endif // __svgen_dq_h__ .c文件 // don't forget to set a proper global_q in "iqmathlib.h" file #include "dsp2833x_device.h" // dsp2833x headerfile include file #include "dsp2833x_examples.h" // dsp2833x examples include file #include "sub_control_svgen_dq_float.h" #ifdef flash_mode #pragma code_section(svgendq_calc,"ramfuncs"); #endif void svgendq_calc(svgendq *v) { float32 va,vb,vc,t1,t2; uint32 sector = 0; // sector is treated as q0 - independently with global q // inverse clarke transformation va = v->ubeta; vb = -0.5*v->ubeta + 0.8660254*v->ualpha; // 0.8660254 = sqrt(3)/2 vc = -0.5*v->ubeta - 0.8660254*v->ualpha; // 0.8660254 = sqrt(3)/2 // 60 degree sector determination if (va>0) sector = 1; if (vb>0) sector = sector + 2; if (vc>0) sector = sector + 4; // x,y,z (va,vb,vc) calculations va = v->ubeta; // x = va vb = 0.5*v->ubeta + 0.8660254*v->ualpha; // y = vb vc = 0.5*v->ubeta - 0.8660254*v->ualpha; // z = vc if (sector==0) // sector 0: this is special case for (ualpha,ubeta) = (0,0) { v->ta = 0.5; v->tb = 0.5; v->tc = 0.5; } if (sector==1) // sector 1: t1=z and t2=y (abc ---> tb,ta,tc) { t1 = vc; t2 = vb; v->tb = 0.5*(1-t1-t2); // tbon = (1-t1-t2)/2 v->ta = v->tb+t1; // taon = tbon+t1 v->tc = v->ta+t2; // tcon = taon+t2 } else if (sector==2) // sector 2: t1=y and t2=-x (abc ---> ta,tc,tb) { t1 = vb; t2 = -va; v->ta = 0.5*(1-t1-t2); // taon = (1-t1-t2)/2 v->tc = v->ta+t1; // tcon = taon+t1 v->tb = v->tc+t2; // tbon = tcon+t2 } else if (sector==3) // sector 3: t1=-z and t2=x (abc ---> ta,tb,tc) { t1 = -vc; t2 = va; v->ta = 0.5*(1-t1-t2); // taon = (1-t1-t2)/2 v->tb = v->ta+t1; // tbon = taon+t1 v->tc = v->tb+t2; // tcon = tbon+t2 } else if (sector==4) // sector 4: t1=-x and t2=z (abc ---> tc,tb,ta) { t1 = -va; t2 = vc; v->tc = 0.5*(1-t1-t2); // tcon = (1-t1-t2)/2 v->tb = v->tc+t1; // tbon = tcon+t1 v->ta = v->tb+t2; // taon = tbon+t2 } else if (sector==5) // sector 5: t1=x and t2=-y (abc ---> tb,tc,ta) { t1 = va; t2 = -vb; v->tb = 0.5*(1-t1-t2); // tbon = (1-t1-t2)/2 v->tc = v->tb+t1; // tcon = tbon+t1 v->ta = v->tc+t2; // taon = tcon+t2 } else if (sector==6) // sector 6: t1=-y and t2=-z (abc ---> tc,ta,tb) { t1 = -vb; t2 = -vc; v->tc = 0.5*(1-t1-t2); // tcon = (1-t1-t2)/2 v->ta = v->tc+t1; // taon = tcon+t1 v->tb = v->ta+t2; // tbon = taon+t2 } // convert the unsigned global_q format (ranged (0,1)) -> signed global_q format (ranged (-1,1)) // v->ta = 2.0*(v->ta-0.5); // v->tb = 2.0*(v->tb-0.5); // v->tc = 2.0*(v->tc-0.5); }
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯