void _ISR _T3Interrupt(void)
{
IFS0bits.T3IF = 0;
flag=1;
}
while(1)
{
if (flag==1)
{
execute my PID algorithm
flag=0;
}
}
can you give details on my queries posted in #1
Do you feel the strategy adopted in #5 is incorrect
Will it not synchronously execute within the interrupt time period?
Maybe it's personal taste, but here I don't agree.If the "my PID algorithm" is short it will work but to be honest I would advise the method in post #5, especially if the MCU is doing other things as well.
* large in instructions: YesCan ISR handle large program?
The question has be answered in detail by KlausST. The total processing time of your controller task doesn't change either if it's performed in ISR or not. Problems arise if you don't know the actual processing time or if it's largely varying. Lengthy ISR routines however block the processing of other interrupts that must be performed in time, e.g interface handlers, unless you introduce well considered interrupt priorities.Can ISR handle large program?
As in non ISR code, variables should be implemented as automatic or static depending on their function. Global or local static is just a matter of the variable scope. There are special considerations for those global variables that are accessed both in ISR and main level.Should we declare all variables within ISR static?
Should we declare all variables within ISR static?
PID controller and want to execute PID algorithm within an ISR...
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?