904 Module Ports
904-module-ports.mc covers module parameters with direction markers, module instances, and explicit module-port connections. Tutorial first use: 06-multi-file-project/061-reusable-module.mc.
Syntax synopsis:
text
module BLOCK(in signal, psnk ground)
{
}
module main
{
BLOCK INSTANCE
INPUT -> INSTANCE.signal
INSTANCE.ground -> GND
}bash
eval "$(../mcc/scripts/mcc-slot.sh)"
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 90-language-reference/904-module-ports.mc --lib mcode --pass1 --pass2 --top mainSource
text
// Reference: Module Ports And Instantiation
// Focus: module parameters, module instances, and explicit port connections.
module STATUS_BLOCK(in signal, psnk ground)
{
RES R_LIMIT(330R, 50V)
LED D_STATUS(2.0V, 5mA)
signal -> R_LIMIT -> D_STATUS.A
D_STATUS.K -> ground
}
module main
{
io GND
io GPIO_STATUS
STATUS_BLOCK STATUS
GPIO_STATUS -> STATUS.signal
STATUS.ground -> GND
}