Skip to content

901 Component Definition ​

901-component-definition.mc covers component, simple attributes, pins, and named physical pins. Tutorial first use: 03-define-components-and-interfaces.

Syntax synopsis:

text
component TYPE_NAME
{
    name = "Display Name"
    pins = [
        1 = PIN_NAME
    ]
}
bash
eval "$(../mcc/scripts/mcc-slot.sh)"
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 90-language-reference/901-component-definition.mc --lib mcode --pass1 --pass2

Source ​

text
// Reference: Component Definition
// Focus: component, name attribute, pins block, named pins.

component REF_SENSOR
{
    name = "Reference Sensor"
    pins = [
        1 = VCC
        2 = OUT
        3 = GND
    ]
}

module main
{
    io GND
    io SENSOR_OUT
    io V3V3

    DC.SRC PWR(3.3V, 20mA)
    REF_SENSOR U_SENSOR

    PWR.1 -> V3V3
    PWR.2 -> GND
    V3V3 -> U_SENSOR.VCC
    U_SENSOR.OUT -> SENSOR_OUT
    U_SENSOR.GND -> GND
}

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