Slope Compensation

What is Slope Compensation

Current-controlled Switch-Mode Power Supplies (SMPS) allow pulse-by-pulse current control and monitoring. This makes them more reliable and more robust than voltage-controlled supplies. A Pulse Width Modulation (PWM) signal can control the output current through feedback from both the switching circuit and the load circuitry. One issue with current-controlled SMPS is that at duty cycles of 50% or greater, the circuit can become unstable, oscillating at half of the switching frequency due to sudden variations in the load current. This is where slope compensation is used to filter out or dampen, the feedback signal variability and restore stable operation.



In an application where a load, such as a bank of LEDs, needs to be driven by a switching boost circuit, a typical schematic will look like the setup below. A Complementary Output Generator (COG) can control the PWM signal within a PIC® MCU device. Feedback at both the transistor switching control and at the output load signal can control the logic circuitry to vary the duty cycle of the PWM signal. Controlling the PWM duty cycle will control the output current.


At PWM duty cycles above 50%, the load current feedback variability can cause the PWM signal to vary considerably. This can cause the PWM signal to vary in frequency and randomly produce instability in the inductor-driven boost circuit.


This is where slope compensation added between the switching current sensing and the load current sensing can help to dampen out the variability. The slope compensation acts as a buffer to supply or reduce voltage to the sensing circuitry to reduce the variability and stabilize the PWM signal while maintaining a constant current supply.


The result is a PWM waveform that is more uniform (blue waveform below) with far less variability in the switching frequency and a more smoothly operating SMPS design.


Slope Compensation Module

The Slope Compensation (SC) module is designed to provide the necessary slope compensation for fixed frequency, continuous current, current mode switched power supplies. The SC module in a PIC® MCU device works by quickly discharging an internal capacitor at the beginning of each Pulse-Width Modulation (PWM) period of the switching power supply control signal. An internal current sink charges this capacitor at a programmable rate. As the capacitor charges, the capacitor voltage is subtracted from the current reference voltage, producing a linear voltage decay at the required rate.

Block diagram of the SC circuit

The PIC16F753 is an example of a PIC MCU device with slope compensation included.

The core of the SC module contains the following:

  • on-chip capacitor in series with the voltage source,
  • shorting switch across the capacitor,
  • calibrated current sink, and
  • one-shot pulse generator to ensure the switch is closed long enough to completely discharge the capacitor.


The input to the SC module can be connected to the following signals:

The output of the SC module can be connected to the follow signals:

Using the 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 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.


Slope Compensation Module Example

Using a PIC16F753 in a simple boost converter circuit, the SLPCCON0 and SLCCON1 registers need to be set up to use the Slope Compensation (SC) module.


The SC module is enabled by setting the SCxEN bit to 1.

The SC module will react to the falling threshold signal from the output of the op amp so the SCxPOL bit is set to 0.

The output connection of the SC module is connected to the Comparator 1 input so the SCxTSS bits are set to 10h.

The input connection to the SC module is the output of the op amp, which is the same as the SLPC1IN selection so the SCxINS bit is set to 0.

When the circuit is using an R3 value of 1 ohm for current sense resistor and the peak current is 1 amp, then the peak current expressed as a voltage (VREF) is 1 volt. If the PWM signal is running at 1 MHz, then the period is 1 microsecond. Therefore, the desired slope is 0.5 Volts/microsecond as seen in the equation below:


According to the SCxISET bits chart, 0.5 V/µs correlates directly to the SCxISET value of 6h, so that value is stored in the SCxISET bits of the SLPCCON1 register. Since this is a direct correlation we can set the range setting to SCxRNG = 0.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.