2011 Microchip Technology Inc.
Preliminary
DS41585A-page 147
PIC10(L)F320/322
21.11 Configuring the CWG
The following steps illustrate how to properly configure
the CWG to ensure a synchronous start:
1.
Ensure that the TRIS control bits corresponding
to CWGxA and CWGxB are set so that both are
configured as inputs.
2.
Clear the GxEN bit, if not already cleared.
3.
Set desired dead-band times with the CWGxDBR
and CWGxDBF registers.
4.
Setup the following controls in CWGxCON2
auto-shutdown register:
Select desired shutdown source.
Select both output overrides to the desired
levels (this is necessary even if not using
auto-shutdown because start-up will be from
a shutdown state).
Set the GxASE bit and clear the GxARSEN
bit.
5.
Select the desired input source using the
CWGxCON1 register.
6.
Configure the following controls in CWGxCON0
register:
Select desired clock source.
Select the desired output polarities.
Set the output enables for the outputs to be
used.
7.
Set the GxEN bit.
8.
Clear TRIS control bits corresponding to
CWGxA and CWGxB to be used to configure
those pins as outputs.
9.
If auto-restart is to be used, set the GxARSEN
bit and the GxASE bit will be cleared automati-
cally. Otherwise, clear the GxASE bit to start the
CWG.
21.11.1
PIN OVERRIDE LEVELS
The levels driven to the output pins, while the shutdown
input is true, are controlled by the GxASDLA and
GxASDLB
bits
of
the
CWGxCON2
register
override level and GxASDLB controls the CWG1B
override level. The control bit logic level corresponds to
the output logic drive level while in the shutdown state.
The polarity control does not apply to the override level.
21.11.2
AUTO-SHUTDOWN RESTART
After an auto-shutdown event has occurred, there are
two ways to have resume operation:
Software controlled
Auto-restart
The restart method is selected with the GxARSEN bit
of the CWGxCON2 register. Waveforms of software
controlled and automatic restarts are shown in
21.11.2.1
Software controlled restart
When the GxARSEN bit of the CWGxCON2 register is
cleared, the CWG must be restarted after an auto-shut-
down event by software.
The CWG will resume operation on the first rising edge
event after the GxASE bit is cleared. Clearing the shut-
down state requires all selected shutdown inputs to be
low, otherwise the GxASE bit will remain set.
21.11.2.2
Auto-Restart
When the GxARSEN bit of the CWGxCON2 register is
set, the CWG will restart from the auto-shutdown state
automatically.
After the shutdown event clears, the GxASE bit will
clear automatically and the CWG will resume operation
on the first rising edge event.