English
Language : 

PIC16LF18854 Datasheet, PDF (304/668 Pages) Microchip Technology – C Compiler Optimized RISC Architecture
PIC16(L)F18856/76
20.12 Configuring the CWG
The following steps illustrate how to properly configure
the CWG.
1. Ensure that the TRIS control bits corresponding
to the desired CWG pins for your application are
set so that the pins are configured as inputs.
2. Clear the EN bit, if not already cleared.
3. Set desired mode of operation with the MODE
bits.
4. Set desired dead-band times, if applicable to
mode, with the CWGxDBR and CWGxDBF reg-
isters.
5. Setup the following controls in the CWGxAS0
and CWGxAS1 registers.
a. Select the desired shutdown source.
b. Select both output overrides to the desired
levels (this is necessary even if not using auto-
shutdown because start-up will be from a shut-
down state).
c. Set which pins will be affected by auto-shut-
down with the CWGxAS1 register.
d. Set the SHUTDOWN bit and clear the REN bit.
6. Select the desired input source using the
CWGxISM register.
7. Configure the following controls.
a. Select desired clock source using the
CWGxCLKCON register.
b. Select the desired output polarities using the
CWGxCON1 register.
c. Set the output enables for the desired outputs.
8. Set the EN bit.
9. Clear TRIS control bits corresponding to the
desired output pins to configure these pins as
outputs.
10. If auto-restart is to be used, set the REN bit and
the SHUTDOWN bit will be cleared automati-
cally. Otherwise, clear the SHUTDOWN bit to
start the CWG.
20.12.1 PIN OVERRIDE LEVELS
The levels driven to the output pins, while the shutdown
input is true, are controlled by the LSBD and LSAC bits
of the CWGxAS0 register. LSBD<1:0> controls the
CWGxB and D override levels and LSAC<1:0> controls
the CWGxA and C override levels. The control bit logic
level corresponds to the output logic drive level while in
the shutdown state. The polarity control does not affect
the override level.
20.12.2 AUTO-SHUTDOWN RESTART
After an auto-shutdown event has occurred, there are
two ways to resume operation:
• Software controlled
• Auto-restart
The restart method is selected with the REN bit of the
CWGxCON2 register. Waveforms of software controlled
and automatic restarts are shown in Figure 20-13 and
Figure 20-14.
20.12.2.1 Software Controlled Restart
When the REN bit of the CWGxAS0 register is cleared,
the CWG must be restarted after an auto-shutdown
event by software. Clearing the shutdown state
requires all selected shutdown inputs to be low, other-
wise the SHUTDOWN bit will remain set. The overrides
will remain in effect until the first rising edge event after
the SHUTDOWN bit is cleared. The CWG will then
resume operation.
20.12.2.2 Auto-Restart
When the REN bit of the CWGxCON2 register is set,
the CWG will restart from the auto-shutdown state
automatically. The SHUTDOWN bit will clear automati-
cally when all shutdown sources go low. The overrides
will remain in effect until the first rising edge event after
the SHUTDOWN bit is cleared. The CWG will then
resume operation.
DS40001824A-page 304
Preliminary
 2016 Microchip Technology Inc.