打印

各路兄弟帮忙看下,程序哪儿出错了?

[复制链接]
2047|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
叶繁终唯枯|  楼主 | 2011-7-31 19:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

#include"DSP28_Device.h"

#include"DSP28_Ev.h"
#include"DSP28_PieCtrl.h"
#include"DSP28_PieVect.h"
#include"DSP28_SysCtrl.h"
#include"DSP28_DefaultIsr.h"
#define PI=3.1415926
interrupt void eva_capint1_isr()

int K1;


int k1;


int Z;


int T1;


int flag1;


int W1;


int
W2;


int
V1;


int
V2;


int
R;


int
r;


int
a1;


int
C1;

void IntEv()
{
EvaRegs.T1PR=0xFFFF;
EvaRegs.T1NT=0;
EvaRegs.T1CON.all=0;
EvaRegs.T1CON.bit.TMODE=2;
EvaRegs.T1CON.bit.TPS=6;
EvaRegs.T1CON.bit.TENABLE=1;
EvaRegs.CAPCONA.all=0;
EvaRegs.CAPCONA.bit.CAP12EN=1;
EvaRegs.CAPCONA.CAP1EDGE=1;
EvaRegs.CAPCONA.bit.CAP12TSEL=1;
EvaRegs.CAPFIFOA.bit.CAP1FIFO=0;
EvaRegs.EVAIFRC.bit.CAP1INT=1;
EvaRegs.EVAIMRC.bit.CAP1INT=1;
}
void main()
{
InitSysCtrl();
EALLOW;
SysCtrlRegs.PLLCR.all=0x000A;
EDIS;
DINT;
IER=0x0000;
IFR=0x0000;
InitPieCtrl();
InitPieVectTable();
InitEv();
EALLOW;
PieVectTable.CAPINT1=&eva_capint1_isr;
EDIS;
PieCtrlRegs.PIEIER3.all=M_INT5;
IER1=M_INT3;
EINT;
while(1)
{
}
}
interrupt void eva_capint1_isr()
{EvaRegs.EVAIFRC.bit.CAP1INT=1;
flag1++;
if(flag1=2)
{
unsigned int cap1T1=EvaRegs.CAP1FIFO;
unsigned int cap1T2=EvaRegs.CAP1FIFO;
if(cap1T2>cap1T1)
{K1=cap1T2-cap1T1;}
else
{K1=cap1T1-cap1T2+0xFFFF;}
W1=2*PI/(Z*K1);
V1=(2*PI)*r/(Z*K1);
}
if(flag1=4)
{flag1=0;
unsigned int cap1t1=EvaRegs.CAP1FIFO;
unsigned int cap1t2=EvaRegs.CAP1FIFO;
if(cap1t1>cap1T2)
{T1=cap1t1-cap1T2;}
else
{T1=cap1T2-cap1t1+0xFFFF;}
if(cap1t2>cap1t1)
{k1=cap1t2-cap1t1;}
else
{k1=cap1t1-cap1t2+0xFFFF;}

W2=2*PI/(Z*k1);


V2=(2*PI)*r/(Z*k1);


a1=(V2-V1)/(T1+k1);


C1=((1200*a1)+(0.3*1.495*V2*V2/21.15))/(2*(V2-R*W2)/V2);

{}
PieCtrl.PIEACK.bit.ACK3=1;
}

相关帖子

沙发
blacksword| | 2011-8-1 08:11 | 只看该作者
晕死,任何代码,只要不讲功能需求,只要能编译过就是正确的。

因此就上面的代码无法给你任何实质性的帮助

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

0

主题

31

帖子

1

粉丝