Implementation
The Interrupt Service Routines (ISR)
›
When the rising edge is detected at the input pin of capture/compare channel 0 (CC60), the
interrupt handler (
CCU6_ICU_Rising_Edge_Int_Handler()
) is triggered
›
The interrupt status flags of the CC60 interrupt have to be cleared inside the ISR
›
The PWM frequency is calculated by dividing the CCU6 capture frequency
(
g_CCU6captureFrequency_Hz
) by the total amount of increments of the timer T12 (the
time between two rising edges)
›
The PWM duty cycle is calculated as a percentage value between the amount of increments
of the timer T12 between the rising and falling edge (high level time) and the total amount of
increments between two rising edges (period).
›
An overflow of timer T12 triggers the second interrupt
(
CCU6_ICU_Period_Match_Int_Handler()
) which is used for counting:
–
the overflows between two rising edges for PWM frequency calculation
–
the overflows between the rising edge and the falling edge for PWM duty cycle calculation
9
2020-01-17
Copyright © Infineon Technologies AG 2020. All rights reserved.