
2.3 Functional Operation
2.3.1 One-Shot Mode Operation
Write
PWM START PWM START
Write
P1D
PER+1
PWM output
Interrupt
2.3.1.1 Event-Triggered One-Shot Mode Operation
Peripheral Architecture
The PWM module can operate in either one-shot or continuous mode. In both modes, the PWM peripheralhas a first-phase duration register (PH1D) and a period register (PER) to specify, respectively, thefirst-phase duration and period of the waveform. The first-phase output level can be configured to beeither high or low in the P1OUT bit of the PWM configuration register (CFG) and the second phase outputis automatically the opposite polarity of the first-phase level. The inactive state before and after the PWMoperation can also be configured to be either a 0 or a 1 in the INACTOUT bit of CFG. For one-shot modeoperation, see Section 2.3.1 ; for continuous mode operation, see Section 2.3.2 .
In one-shot mode operation, the PWM produces a series of periods but does not run continuously. Thenumber of periods in the series is controlled by the repeat count contained in the PWM repeat countregister (RPT). To select one-shot mode, configure the MODE bit in the PWM configuration register (CFG)to 1h.
For one-shot mode operation, the PWM should first be configured for mode, period, and first-phaseduration, along with other configuration options. The PWM uses the last programmed set of parametersonce it is started by writing a 1 to the START bit in the PWM start register (START).
Once started, the PWM asserts/deasserts the output as configured, driving to the first-phase output levelduring the first phase and the opposite level during the second phase. When the prescribed number ofRPT + 1 periods of pulses expire, the peripheral sends an interrupt to the system (if the interrupt isenabled in CFG). The PWM then becomes inactive until the START bit is written a 1 again.
The PWM is stopped during one-shot mode operation by changing the MODE bit to 0 (disable). When thePWM is disabled, the output is immediately driven to the configured inactive state.
Figure 2 shows the one-shot mode operation. The waveform generation is started by writing to the STARTbit (assuming event triggering is disabled). After RPT + 1 number of periods, the waveform stops and aninterrupt is generated. The polarity is configured as inactive low, first phase high-then-low.
Figure 2. PWM One-Shot Mode Operation (P1OUT = 1, INACTOUT = 0, EVTRIG = 0, PWM_RPT = 2)
In one-shot mode, the PWM senses a rising or falling transition on an event-trigger input signal to start theoperation. This event trigger input is synchronized to the PWM clock inside the module and is driven bythe video processing subsystem CCDC_VD output signal. This capability is provided to allow the PWM tobe used as a CCD timer.
The trigger event can be detected on the rising edge or the falling edge of CCDC_VD. After eventtriggering is enabled as part of the configuration process, a write to the PWM START register (START)starts the sensing circuitry in the PWM and after the first event, the PWM starts the period counting.
Figure 3 shows the event-triggered one-shot mode operation. Note that each subsequent event does notrestart period counting. It takes another write to the START bit to sense the event signal again. Also note,that events received within the PWM period are ignored as well.
10 Pulse-Width Modulator (PWM) Peripheral SPRUEE7A – May 2006 – Revised September 2007Submit Documentation Feedback