Skip to content

204 Buck Module 12 V to 5 V ​

204-buck-12v-to-5v.mc describes a complete 12 V to 5 V buck module as a three-terminal regulator block. This is the beginner representation to use when the selected module or regulator hides its switch node, inductor, and feedback network inside the part.

The 12 V source creates V12V and GND. V12V feeds U_BUCK_MODULE.INPUT, U_BUCK_MODULE.OUTPUT creates V5V, and the module ground returns to GND. C_IN and C_OUT are the external input and output capacitors. There is deliberately no SW or FB connection in this file: those belong to the controller-level topology in 206.

Parse 204-buck-12v-to-5v.mc:

bash
eval "$(../mcc/scripts/mcc-slot.sh)"
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 20-power-recipes/204-buck-12v-to-5v.mc --lib mcode --pass1 --pass2

Generate HTML for 204-buck-12v-to-5v.mc:

bash
eval "$(../mcc/scripts/mcc-slot.sh)"
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 20-power-recipes/204-buck-12v-to-5v.mc --lib mcode --viz -o 20-power-recipes/204-buck-12v-to-5v.html

Source ​

text
// Example: Buck Module 12 V to 5 V
// Goal: Treat a complete buck module as a three-terminal regulator block.
// Library focus: REG, CAP, DC.

use mcfam.power/reg.mc

module main
{
    io GND
    io V12V
    io V5V

    DC.SRC PWR(12V, 2A)
    REG U_BUCK_MODULE(5V, 1A, 12V)
    CAP.MLCC C_IN(10uF, 25V)
    CAP.MLCC C_OUT(22uF, 10V)

    PWR.1 -> V12V
    PWR.2 -> GND
    V12V -> U_BUCK_MODULE.INPUT
    U_BUCK_MODULE.OUTPUT -> V5V
    U_BUCK_MODULE.GND -> GND
    V12V -> C_IN -> GND
    V5V -> C_OUT -> GND
}

MCode Bench is the public face of the MCode stack. Closed capabilities are served through the MCode gateway.