Tool/software: Code Composer Studio
I am writing a control algorithm to run in one of the PWM interrupt with frequency of 20kHz. Meaning it happens every 5 u sec. My code can be a little bit hairy and takes more that 5 u sec. I was wondering what happens if my code in intrupt takes more than interrupt time period?
interrupt void CONTROL(void){
Angle_update();
ADCRead();
PQ_compute();
Fault_detection();
Sync_check();
if (sync==0){
Vq_ref_SVM=Vq_pu;
Vd_ref_SVM=Vd_pu;
}
if (sync==1){
if (controller_type==0){
IQD();
Delta=__atan(Vd_ref_SVM/Vq_ref_SVM);
abs_v_compute();
}
else{
angle_control();
v_control();
}
}
if(fault_on==0){
SVM();
}
else{
EPwm5Regs.CMPA.bit.CMPA=0;
EPwm2Regs.CMPA.bit.CMPA=0;
EPwm6Regs.CMPA.bit.CMPA=0;
}
L2_on;
FeedForward(V_abs,Delta_a_f,&P_pr,&Q_pr );
FeedForward(V_abs,Delta_a_f,&P_pr,&Q_pr );
L2_off;
steady_state_check();
/* t_count2=t_count2+1;
if (t_count2>500){
send_flag=1;
t_count2=0;
} */
//send_flag=1;
if (send_flag==1){
t_count=t_count+1;
if (t_count>3){
Data_send();
t_count=0;
}
}
EPwm1Regs.ETCLR.bit.INT=1;
PieCtrlRegs.PIEACK.all |= PIEACK_GROUP3;
}