13 PWM Timer (T16E)
S1C17601 TECHNICAL MANUAL
Seiko Epson Corporation
13-9
13.7 PWM Timer Interrupts
The T16E module includes functions for generating the following two kinds of interrupts:
Compare A match interrupt
Compare B match interrupt
The T16E module outputs a single interrupt signal shared by the above two interrupt factors to the interrupt
controller (ITC). (Two channels output two interrupt signals in total.) The interrupt flag within the T16E module
should be read to identify the interrupt factor that occurred.
Compare A match interrupt
This interrupt request is generated when the counter matches the compare data A register setting during
counting. It sets the interrupt flag CAIF (D0/T16E_INTx register) within the T16E module to 1.
CAIF: Compare A Interrupt Flag in the PWM Timer Ch.x Interrupt Flag (T16E_IFLGx) Register
(D0/0x530c/0x536c)
To use this interrupt, set CAIE (D0/T16E_IMSK register) to 1. If CAIE is set to 0 (default), CAIF is not set to 1,
and the interrupt request for this factor is not sent to the ITC.
CAIE: Compare A Interrupt Enable Bit in the PWM Timer Ch.x Interrupt Mask (T16E_IMSKx) Register
(D0/0x530a/0x536a)
If CAIF is set to 1, the T16E module outputs an interrupt request to the ITC. An interrupt is generated if the
ITC and S1C17 core interrupt conditions are satisfied.
CAIF should be read and checked within the PWM Timer interrupt processing routine to determine whether the
PWM Timer interrupt is attributable to compare A matching.
Compare B match interrupt
This interrupt request is generated when the counter matches the compare data B register setting during
counting. It sets the interrupt flag CBIF (D1/T16E_INTx register) within the T16E module to 1.
CBIF: Compare B Interrupt Flag in the PWM Timer Ch.x Interrupt Flag (T16E_IFLGx) Register
(D1/0x530c/0x536c)
To use this interrupt, set CBIE (D1/T16E_INTx register) to 1. If CBIE is set to 0 (default), CBIF is not set to 1,
and the interrupt request for this factor is not sent to the ITC.
CBIE: Compare B Interrupt Enable Bit in the PWM Timer Ch.x Interrupt Mask (T16E_IMSKx) Register
(D1/0x530a/0x536a)
If CAIF is set to 1, the T16E module outputs an interrupt request to the ITC. An interrupt is generated if the
ITC and S1C17 core interrupt conditions are satisfied.
CAIF should be read and checked within the PWM Timer interrupt processing routine to determine whether the
PWM Timer interrupt is attributable to compare A matching.
Note: To prevent interrupt recurrences, the T16E module interrupt flags CAIF and CBIF must be
reset within the interrupt processing routine following a PWM Timer interrupt.
To prevent generating unnecessary interrupts, reset the corresponding CAIF or CBIF before
permitting compare A or compare B interrupts from CAIE or CBIE.