This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
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; }
Hi,
This can lead to delayed next interrupt or intermediate misses.
Thanks
Vasudha
But my main question is what happens if it is in the middle of code and the next interrupt signal comes? Does it finish the code then go to interrupt or it leaves in the middle of the code and start over?
Assuming you did not have SW re-enable the interrupt you are currently processing, the ISR will run to completion and then take the pending interrupt.
Regards,
David