Skip to content

021 Zener Clamp Branch ​

021-zener-clamp.mc places a series resistor between VIN and VCLAMP, then adds a Zener path from VCLAMP to GND. DIO.ZEN is the Zener type in the DIO namespace. Its arguments add tolerance (%) and power (W) units. The cathode faces the protected node and the anode faces ground, so the diode is reverse-biased during normal operation.

bash
eval "$(../mcc/scripts/mcc-slot.sh)"
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 02-circuits-with-branches/021-zener-clamp.mc --lib mcode --pass1 --pass2
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 02-circuits-with-branches/021-zener-clamp.mc --lib mcode --viz -o 02-circuits-with-branches/021-zener-clamp.html

Source ​

text
// Example: Zener Clamp Branch
// Goal: Add a clamp branch from a protected node to ground.
// Library focus: DIO.ZEN, RES.

module main
{
    io GND
    io VCLAMP
    io VIN

    RES R_SERIES(1000R, 50V)
    DIO.ZEN Z_CLAMP(5.1V, 0.5W, 5%)

    VIN -> R_SERIES -> VCLAMP
    // Reusing VCLAMP starts a second path from the protected node.
    VCLAMP -> Z_CLAMP.K
    Z_CLAMP.A -> GND
}

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