本帖最后由 mr.pengyongche 于 2013-4-30 03:25 编辑
采用不对称规则采样算法生成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");}
[url=www.6668.cc]
1
|
|
|
|
ddddddddddddddddddddddddddddddddd
|
|
|
|
|
dddddddddddddddddddddddddddddddddddd
|
|
|
|
|