Using 8-bit PIC® MCU Slope Compensation Module
The Slope Compensation Control 0 (SLPCCON0) register controls the operation of the module.
The Slope Compensation (SC) module can be enabled or disabled by the SCxEN bit.
The SC can act on a signal crossing the rising or falling threshold. This is set with the SCxPOL bit.
The output connection of the SC module is selected by the SCxTSS bits.
The input connection to the SC module is selected by the SCxINS bit.
Setting the Slope Compensation Rate
To set the Slope Compensator rate, the input reference voltage and Pulse Width Modulation (PWM) period must first be determined.
The input reference voltage is simply set to the target circuit peak current sense voltage at the load sensing circuit. The PWM period is simply the inverse of the PWM drive frequency.
The slope compensation output voltage starts at the input reference voltage and should fall at a rate of less than half the target circuit current sense voltage rate of rise. Therefore, the compensator slope, expressed as volts per microsecond, can be computed as shown in the following equation.
This calculated slope compensator value is loaded into the Slope Compensator Current Sink Set (SCxISET) bits of the SLPCCON1 register per the table of values. The range of values can also be adjusted with the slope compensator range bit.
The SCxRNG bit allows you to select the range for the slope of the compensation.
The SCxISET bits set the slope rate value per the following chart.