采用不对称规则采样算法生成SPWM波的部分源程序:
#include "lf2407regs.h"
#include "math.h"
//#define N 81
#define N 234
#define pi 3.1415926
float M=1.0;
float f=50;
int i;
unsigned int k1=0,k2=N/3,k3=2*N/3;
float lw_sin[N];
int FOOT=1;
#define T 40000000/(2*f*N)//f*2N=fc
void inline disable()
{asm(" setc INTM");}
void inline enable()
{asm(" clrc INTM");}
用DSP编程spwm波形的产生.pdf
(205.28 KB)
|