The MPLAB Blockset adds a dedicated Microchip tab to the Simulink toolstrip (ribbon). Every common action โ configuring the target, inserting a peripheral, generating code, flashing the board, and live-tuning over External Mode โ is one click away from this tab. This page documents each button.
The Microchip tab appears automatically when a model is configured for a Microchip target (it has a Microchip Master block, or its System target file is one of the
MCHP_*_stf.tlctargets).
The tab is organised into sections, left to right:
| Section | Purpose |
|---|---|
| Setup | Board templates, target configuration |
| Edit | Insert peripheral, View Code, open in MPLAB X / VS Code |
| Build | Generate code, Build-Deploy-Start, Clean folder |
| Ext-Mode | External Mode / PIL settings, Monitor & Tune, PicGui |
| Tune | Tunable parameters (promote / audit / show / bind) |
| Sim-Only | Toggle and highlight simulation-only blocks |
Opens the board-template gallery โ a grid of ready-to-build starter models for the supported development boards (MCLV-2, MCLV-48V-300W, MCHV-230VAC, Curiosity Nano, MCDB, โฆ). Picking one creates a new model pre-wired for that board and DIM. See Board Templates .
Command: MCHP_Fun.openBoardTemplate()
Opens a card-style picker of the peripheral blocks that the currently selected chip actually supports, and drops the chosen block into the model โ one block at a time, with no pin conflicts.
The list is filtered by the chip’s real peripheral set: a chip that has the modern High-Speed ADC / PWM does not offer the legacy ADC / PWM block, and vice-versa. (The same filter powers the right-click Insert Peripheral context-menu item.)
Command: MCHP_Fun.insertPeripheralBlock()
Opens the generated C source for the model (after a build) in the MATLAB editor / code view, with traceability back to the originating blocks.
Command: MCHP_Fun.viewCode()
Opens the generated project (.X) in MPLAB X IDE for hardware debugging,
breakpoints, and the full Microchip debug toolchain.
Opens the generated project in Visual Studio Code (with the MPLAB extension), for users who prefer a VS Code workflow.
Command: MCHP_Fun.openInVsCode()
Runs Embedded Coder to produce the C source and the .X project without
compiling or flashing. Useful for inspecting the generated code or building
externally.
Command: MCHP_Fun.generateCodeOnly()
The one-click path: generate code โ compile with the XC compiler โ program the
target โ start execution. Equivalent to Ctrl+B plus deploy.
Command: MCHP_Fun.buildDeployStart()
Removes build artefacts (slprj/, the .X project, generated .c/.h,
.hex/.elf) for a clean rebuild.
Command: MCHP_Fun.CleanFolder(bdroot)
Opens the External Mode configuration dialog โ pick the COM port (the PKOB nano CDC virtual serial port), baud rate, and transport. See External Mode .
Command: MCHP_ExtModeGui(bdroot)
Opens the Processor-in-the-Loop configuration. See PIL Testing .
Command: MCHP_PILGui(bdroot)
Builds, flashes, and starts streaming live signals to the Simulink scopes while letting you tune parameters on the running target โ all in one click. This is the External Mode “go” button.
Command: MCHP_Fun.monitorTuneGuarded()
Launches the picgui MATLAB host interface for interactive UART communication and real-time plotting (used with the UART Tx-Matlab block). See picgui .
Command: picgui
A three-row stack for exposing block parameters as calibratable variables reachable over XCP / External Mode. See the dedicated Tunable Parameters guide.
| Button | Action |
|---|---|
| Tunable param | Promote the selected block’s literal parameters to tunable Simulink.Parameters |
| Tunable audit | Whole-model audit table of every promotable field |
| Tunable show | Highlight tunable (XCP-reachable) vs C-only blocks on the canvas |
| Bind slider | Attach a dashboard Slider/Knob to a promoted parameter |
| Tunable โฆ | Drop-down with the full verb set (export/import calibration set, rename, revert) |
Commands: MCHP_Fun.tunable.run('promote' | 'audit' | 'highlight' | 'bind')
Mark blocks as simulation-only (excluded from code generation), highlight them on the canvas, or clear the highlight. Useful for keeping plant models, scopes, and test harnesses in the same model as the embedded algorithm without generating code for them.
Commands: MCHP_Fun.toggleSimOnly(), MCHP_Fun.highlightSimOnly(bdroot),
MCHP_Fun.clearSimOnlyHighlight(bdroot)
| Shortcut | Action |
|---|---|
Ctrl+B | Build (generate + compile + deploy) |
Ctrl+D | Update diagram (refresh pin/peripheral allocation after edits) |
Ctrl+U | Look under a masked subsystem (e.g. the BOARD block in a template) |