ISD91200 Series Technical Reference Manual
Release Date: Sep 16, 2019
- 179 -
Revision 2.4
5.7.9
PWM-Timer Interrupt Architecture
There are two PWM interrupts, PWM0_INT, PWM1_INT, which are multiplexed into PWM0_IRQ. PWM
0 and Capture 0 share one interrupt, PWM1 and Capture 1 share the same interrupt. Figure 5-32 PWM-
Timer Interrupt Architecture Diagram demonstrates the architecture of PWM-Timer interrupts.
PWM0_INT
PWMIF0
CAPIF0
PWM1_INT
PWMIF1
CAPIF1
PWMA_IRQ
Figure 5-32 PWM-Timer Interrupt Architecture Diagram
5.7.10 PWM-Timer Initialization Procedure
The following procedure is recommended for starting a PWM generator.
1. Setup clock selector (PWM_CLKDIV)
2. Setup prescaler (PWM_CLKPSC)
3. Setup inverter on/off, dead zone generator on/off, auto-reload/one-shot mode and Stop PWM-
timer (PWM_CTL)
4. Setup comparator register (PWM_CMPDAT)to set PWM duty cycle.
5. Setup PWM down-counter register (PWM_PERIOD) to set PWM period.
6. Setup interrupt enable register (PWM_INTEN)
7. Setup PWM output enable (PWM_POEN)
8. Setup the corresponding GPIO pins to PWM function (SYS_GPA_MFP)
9. Enable PWM timer start (Set CNTENx = 1 in PWM_CTL)
5.7.11 PWM-Timer Stop Procedure
•
Method 1:
Set 16-bit down counter (PWMx_PERIODx) as 0, and monitor PWMx_CNTx (current value of 16-bit
down-counter). When PWMx_CNTx reaches to 0, disable PWM-Timer (CNTENx in PWMx_CTL).
(Recommended)
•
Method 2:
Set 16-bit down counter (PWMx_PERIODx) as 0. When interrupt request occurs, disable PWM-Timer
(CNTENx in PWMx_CTL).
(Recommended)
•
Method 3:
Disable PWM-Timer directly (CNTENx in PWMx_CTL).
(Not recommended)