I have two interrupt functions: one for generation of PWM signal for sinewave generation and the other is for (PWM) generating signal to battery charger.
Whenever the supply is available the battery charger PWM interrupt function should work and the sinewave generation PWM must be turned off and vice-versa.
I am using only one CCP Pin for the both functions. How to manage it? Can I use software logic [A conditions if()] for each function to run?
void interrupt timer_isr()
{
if(TMR2IF==1) // first interrupt function for sinewave // Function A
{
// contents
TMR2IF = 0;
}
if() // second interrupt function for Battery charging // Function B
{
}
}
What is the technique to run only one of the function as said above? Here the TIMER2 module is used for the two operations, i.e. the function A and B.