Hi Kef,
I enable PWM channel 0 and PWM Channel1.I enable the KWP interrupt for PWMchannel 0 and Falling edge.
I checked interrupt is commingbut when I watch the PIFP register it is showing values as 3.
That means it is seting the bit for PWM channel 1 also.If all PWM channels(7) get enabled so the interrupt will come to one interrupt service routine.
In ISR,I need to detect the source of interrupt and call the associated callback function of that channel.
e.g-In ISR,suppose I find out the interrupt is by PWM channel0 then Ishould call a call back function of that channel lets...void dumy(void);
My interrupt service routine looks like this-
interrupt void Pwm_EdgeNotification(void)
{
/* Determine the interrupt source and call corresponding Notification */
switch(PIFP)
{
case PWM_0:
if(s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL0].PWM_NOTIFICATION_Channel != NULL)
{
s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL0].PWM_NOTIFICATION_Channel();
}
else
{
/*Do Nothing */
}
PIFP_PIFP0 = 1;
break;
case PWM_1:
if(s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL1].PWM_NOTIFICATION_Channel != NULL)
{
s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL1].PWM_NOTIFICATION_Channel();
}
else
{
/*Do Nothing */
}
PIFP_PIFP1 = 1;
break;
case PWM_2:
if(s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL2].PWM_NOTIFICATION_Channel != NULL)
{
s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL2].PWM_NOTIFICATION_Channel();
}
else
{
/*Do Nothing */
}
PIFP_PIFP2 = 1;
break;
case PWM_3:
if(s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL3].PWM_NOTIFICATION_Channel != NULL)
{
s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL3].PWM_NOTIFICATION_Channel();
}
else
{
/*Do Nothing */
}
PIFP_PIFP3 = 1;
break;
case PWM_4:
if(s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL4].PWM_NOTIFICATION_Channel != NULL)
{
s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL4].PWM_NOTIFICATION_Channel();
}
else
{
/*Do Nothing */
}
PIFP_PIFP4 = 1;
break;
case PWM_5:
if(s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL5].PWM_NOTIFICATION_Channel != NULL)
{
s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL5].PWM_NOTIFICATION_Channel();
}
else
{
/*Do Nothing */
}
PIFP_PIFP5 = 1;
break;
case PWM_6:
if(s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL6].PWM_NOTIFICATION_Channel != NULL)
{
s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL6].PWM_NOTIFICATION_Channel();
}
else
{
/*Do Nothing */
}
PIFP_PIFP6 = 1;
break;
case PWM_7:
if(s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL7].PWM_NOTIFICATION_Channel != NULL)
{
s_pPwm_Config_Ptr->ChannelConfig \
[PWM_CHANNEL7].PWM_NOTIFICATION_Channel();
}
else
{
/*Do Nothing */
}
PIFP_PIFP7 = 1;
break;
default:
break;
}/*End OF Switch Block */
}/*End Of Pwm_EdgeNotification */
But this code is not working as PIFP sets the bits for all enabled PWM channels.Is there any way to solve this problem.
Regards,
Satyajit