interrupt void MainIsr(void)
{
ILo = iLo;
ILo_ref = ILO_REF;
ILo_error = ILo_ref-ILo;
ILo_Inter += ILo_error*ILo_I;
if(ILo_Inter > 400)
ILo_Inter = 400000;
else if(ILo_Inter < -400)
ILo_Inter = -400000;
ILo_out = ILo_Inter+ILo_P*ILo_error;
if(ILo_out > 500)
ILo_out = 5000000;
else if(ILo_out < -500)
ILo_out = -5000000;
Uzaibo = ILo_out*0.00009;
// Uzaibo_out = -Uzaibo*30000/2+30000/2;
EPwm2Regs.TBPHS.half.TBPHS = 0.0*30000;//1.06*30000;
EPwm3Regs.TBPHS.half.TBPHS = 1.0*30000;//1.1538*30000;
EPwm4Regs.TBPHS.half.TBPHS = (1.1+0.5*Uzaibo)*30000;//0.1438*30000;+0.5*Uzaibo
EPwm5Regs.TBPHS.half.TBPHS = (0.1+0.5*Uzaibo)*30000;//0.1438*30000;
EPwm2Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;//+Uzaibo
EPwm3Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;
EPwm4Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;
EPwm5Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;
//EPwm1Regs.CMPA.half.CMPA=30000/2;
//EPwm2Regs.CMPA.half.CMPA=30000/2;
EPwm1Regs.ETCLR.bit.INT =1;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; //响应本次接收中断;
// return;
}
请问这个中断函数的问题在哪里,PI控制器的写法是不是有问题,因为我从结果得出的结论是PI控制器没有起作用!
|