Specifications
© 2008-2012 Microchip Technology Inc. DS70323E-page 43-73
Section 43. High-Speed PWM
High-Speed PWM
43
43.10.1 PWM Fault Generated by the Analog Comparator
To use the comparator output as one of the fault/current-limit sources, remap the comparator
output to a general I/O (GPIO) pin and remap one of the external faults as an input to the same
pin. Remapping can be to a GPIO pin or to a virtual pin.
Virtual pins are identical in functionality to all other RPx pins, with the exception of pinouts. The
four virtual pins are internal to the devices and are not connected to a physical device pin. The
comparator output remap to the virtual pin is illustrated in Figure 43-35.
For example, the output of the Analog Comparator and the PWM fault input can be configured
for RP32. This configuration allows the Analog Comparator to trigger PWM faults without the use
of actual physical pin on the device. Refer to the “I/O Ports” chapter in the specific device data
sheet for more details on virtual pins.
Example 43-20 shows the configuration of the Analog Comparator 1 as one of the fault sources
to the PWM that is connected to the fault input pin 1. The following output and input functions are
used:
• Output Function: Analog Comparator 1
• Input Function: PWM Fault Pin 1
Example 43-20: Configuring Analog Comparator as a Fault Source to the PWM
Figure 43-35: Comparator Output Remap to the Virtual Pin
Note: This section only applies to devices with remappable I/O. Refer to the Controller
Family tables in the specific device data sheet for the list of available peripherals.
For devices without remmappable I/O the analog comparators can be directly
assigned as fault source by configuring the FLTSRC<4:0> (FCLCONx<7:3>) bits as
shown in Figure 43-34.
/* Unlock Registers */
__builtin_write_OSCCONL(OSCCON & ~(1<<6));
/* Configure Comparator Output Function */
RPOR16bits.RP32R = 0b100111; /* Assign ACMP1 To Pin RP32 */
/* Configure Fault Input Function */
RPINR29bits.FLT1R=32; /* Assign Fault1 To Pin RP32 */
/* Lock Registers */
__builtin_write_OSCCONL(OSCCON | (1<<6));
Note: The comparator output can also be remapped to a general purpose I/O (GPIO) pin.
FLTSRC<4:0>/CLSRC<4:0>
CMP1x
00000
00001
00010
00100
00101
00110
00111
00011
RPx
Analog Comparator Module
Virtual Pin