001 Power Net
001-power-net.mc creates a 5 V source and names its positive and ground nets. It introduces the basic shape of a runnable MCode file:
text
module main
{
io GND
io V5V
DC.SRC PWR(5V, 500mA)
PWR.1 -> V5V
PWR.2 -> GND
}//starts a line comment.module maindeclares the entry module that MCC runs.{and}delimit its body; indentation is for readability.io V5Vandio GNDexplicitly declare named bidirectional connection points in the module. A name alone does not establish a voltage or a ground contract; the source pins and wiring establish the circuit connections.DC.SRCis theSRCcomponent type in theDCnamespace.PWRis this source instance's local name.(5V, 500mA)supplies positional arguments.VandmAare physical unit suffixes, and the comma separates arguments.PWR.1selects physical pin 1 ofPWR. The dot selects a member of an instance.->connects its left and right operands.V5VandGNDgive readable names to the two electrical nodes.
Pin 1 of DC.SRC is positive and pin 2 is ground, so the two connection statements create the expected supply rails.
bash
eval "$(../mcc/scripts/mcc-slot.sh)"
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 00-getting-started/001-power-net.mc --lib mcode --pass1 --pass2
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 00-getting-started/001-power-net.mc --lib mcode --viz -o 00-getting-started/001-power-net.htmlSource
text
// Example: Power Net
// Goal: Introduce a minimal module, a source component, and named power nets.
// Library focus: DC.
module main
{
io GND
io V5V
DC.SRC PWR(5V, 500mA)
PWR.1 -> V5V
PWR.2 -> GND
}