Configuring a switch-mode power supply (SMPS) on an embedded controller means coordinating feedback, PWM generation, protection, and device peripherals. The MCC SMPS Library brings these functions into a structured workflow for supported 8-bit PIC microcontrollers, using MPLAB Code Configurator (MCC) to set parameters and generate source code. For engineers developing embedded power-control applications, its main value is a choice of configuration depth: build from individual peripheral-oriented blocks or start with a control mode or converter topology.
How the MCC SMPS Library organizes a design
The library is an add-on for MCC within MPLAB X IDE. Its modules are arranged in three levels:
- CIP blocks: Fundamental building blocks that configure Core Independent Peripherals (CIPs), such as comparators, digital-to-analog converters, programmable ramp generators, PWM modules, and operational amplifiers.
- Control modes: Combinations of blocks configured as a PWM controller, including Peak Current Mode Control (PCMC) and Voltage Mode Control (VMC).
- Power-supply topologies: Higher-level modules that apply a control mode to a specified converter design, such as a synchronous buck or a SEPIC LED driver.
A topology or control-mode module can load the lower-level submodules it uses. This hierarchy reduces the need to configure every peripheral independently, while CIP blocks remain available when a design calls for more direct control. The documented device support includes PIC16(L)F176X and PIC16(L)F177X families; engineers should confirm compatibility against the device documentation and the library version used for a project.
Configuration workflow and peripheral assignment
Within MCC, each module provides an information view, a configuration area, a schematic, and a Pin Manager section. The configuration controls map to specific peripheral settings, while the schematic shows how selected blocks and submodules connect. An Upload All action loads the submodules and peripherals used by a module; individual upload controls allow selective loading.
Configuration follows a deliberate direction through the hierarchy. A parameter set at a higher level is passed to its corresponding lower-level module, but changing the lower-level value does not update the higher-level setting. The same principle applies to pin management: higher-level selections configure lower-level assignments, not the reverse. This avoids circular dependencies, but it means engineers should make important choices at the intended level and review pin assignments after changing peripherals.
To use the library, install its archive through the MCC plug-in options in MPLAB X IDE, then select the required modules in MCC. Multiple installed library versions can be selected from the Versions tab. Because dialogs and tool behavior can vary by release, check the documentation that matches the installed software.
Choosing a control mode
Peak Current Mode Control
PCMC uses an outer feedback loop and an inner inductor-current loop. The compensator compares the output feedback signal with a reference and produces an error signal. That signal sets the current-loop reference; slope compensation modifies it to help avoid subharmonic oscillation. The modulator then compares the current-sense input with the reference to determine the PWM duty cycle.
PCMC configuration includes switching frequency, maximum duty cycle, slope compensation, comparator inputs, and PWM timing such as dead time and blanking. Complementary drive outputs can support a half-bridge arrangement where appropriate. A separate open-loop PWM option is available at the modulator-block level for hardware validation, but it disables regulation. Designers must choose open-loop frequency and duty ratio carefully to avoid damaging the power stage.
Voltage Mode Control
VMC compares the compensated output-voltage error with an internally generated sawtooth ramp. The comparison determines PWM duty cycle. Along with settings such as frequency, maximum duty cycle, and error-amplifier reference, VMC includes start and stop values for the ramp. Those settings affect the ramp’s slew rate and therefore form part of the control design, rather than being merely interface preferences.
Topology modules, protection, and dimming
The synchronous buck module supports a converter that steps down its average output voltage relative to the input. It can use synchronous rectification, with a complementary low-side switch, or operate asynchronously by disabling that switch drive. Its settings include control mode, PWM parameters, reference voltage, timing, and slope compensation; ramp start and stop settings apply to VMC operation.
The SEPIC_LED module combines PCMC in single-ended mode with LED dimming. A SEPIC can regulate its output when the input is either above or below the output and provides a noninverted output relative to the input ground. The module exposes switching and dimming parameters, including dimming frequency and duty cycle, as well as overvoltage protection and leading-edge blanking. The pulse modulator uses additional PWM and digital signal modulation functions to coordinate dimming behavior.
A Fault Block can compare a fault input against a programmable reference and trigger PWM shutdown through the output logic. Configuring the block is not by itself the entire application step: the generated fault-protection function must also be called in application code. Control-mode drivers provide basic soft-start code, but the library does not provide a separate setting for ramp-up timing; effective startup time depends on feedback-loop bandwidth and compensator design.
From generated configuration to validation
After selecting and configuring modules, MCC generates C source and header files, along with the drivers needed for the selected blocks. A practical design sequence is to:
- Choose the configuration level that matches the required balance of convenience and peripheral-level flexibility.
- Confirm that the selected CIPs are compatible with the target device and with one another.
- Assign feedback, current-sense, PWM output, and fault pins, checking assignments again if peripherals change.
- Review control-loop parameters and protection thresholds against the power-stage design.
- Integrate the required startup and fault-protection calls, then validate the converter on hardware.
The library’s hierarchy can make PIC SMPS configuration more manageable, but generated code does not replace power-stage analysis or hardware validation. Engineers should treat peripheral compatibility, pin mapping, control-loop behavior, and protection integration as connected design tasks. Selecting the right module level helps establish the configuration; careful review and testing determine whether it is suitable for the application.