Other Parts Discussed in Thread: C2000WARE
Hi,
In my code I am running my routine at 50us using ADC interrupt triggered using PWM. My code is related to AC induction motor control.
At every 50us adc interrupt is generated and after taking adc value , I made ISR flag true. this flag I used in while loop to check and run my code.
In while loop I am calling some function which uses libraries of motor control and IQmath macros/functions.
In while loop I am using motor control and IQmath macros like ACIFE_MACRO, _IQsinPU etc. and doing some calculation.
when I run my code in RAM it runs properly and I toggle a gpio in while loop which toggle at every 50us. but when I run my code in flash the gpio doesn't toggle at 50us instead it toggle at 200us to 250us.
By commenting and uncommenting some part in routine I found that when I commented ACIFE_MACRO() the gpio is toggled at 100us.
after then I uncomment the ACIFE_MACRO and commented the _IQsinPU,_IQcosPU macros used in routine then the gpio is toggling at 150us.
Taking reference from HVACI_Senorless_2833x, I have used #pragma CODESECTION to copy the routine function which is in while loop.
When I use this and uncomment the ACIFE_MACRO and _IQsinPU, _IQcosPU the gpio is toggling at 150us.
So I commented the ACIFE_MACRO,_IQsinPU, _IQcosPU and use #pragma CODESECTION in code then gpio is toggling at 50us as expected.
this is what it looks like in code
void main()
{
.....
while(1)
{
if(adcisrflag)
{
//Toggle gpio and Do some routine
//Want to complete routine before next adcisr
}
}
}
_interrupt adc_isr() //adc isr is triggered at every 50us
{
adcisrflag = 1;
}
I think ACIFE_MACRO,_IQsinPU/_IQcosPU taking more time to run maybe.
can you please suggest any solution to this?
Thanks & Regards.