File Exchange

image thumbnail

MPLAB Device Blocks for Simulink

version 3.45.01 (8.09 MB) by Lubin Kerhuel
dsPIC, PIC32 and SAM7x Support package for Embedded Coder


Updated 28 Jun 2019

GitHub view license on GitHub

Microchip official blockset v3.45 supporting up to 300 microcontrollers.

This support package enables code generation of real-time executable for dsPIC :registered:, PIC32 :registered: and SAM7x from a Simulink model.

Peripheral blocks configure and inserts code in the code generated by the MW embedded coder. (non-exhaustive peripheral block list: ADC, QEI, PWM, IC, OC, CN, I2C, SPI, UART, Op-Amp, Comparator, DAC...)

Code is generated, compiled and uploaded into your board from the single "Build" button on top right of Simulink models.

No embedded programming knowledge is required. The toolbox transforms any board equipped with a supported MCU into a rapid control prototyping tool and enable a model-based design development scheme.


A single-tasking or multi-tasking scheduler implement efficiently advanced multi-rate models.

Advanced configuration of ADC coupled with PWM peripheral enable PMSM motor algorithm where ADC sample time must be triggered precisely within a PWM duty-cycle. The time step might also be triggered by end of ADC conversion minimizing delays.

A custom protocol allows visualizing and recording data through the UART. The custom picgui interface allows plotting using your own matlab script incoming data in real-time. Data log enable further analysis or offline identification and allow to feed a simulation with real data.

The custom "C function" block allows including your own code if required.

The blockset also support MathWorks features like:
- Hardware in the loop (HIL)
- External mode features.
- Code replacement to benefit from DSP architecture of dsPIC

This version embed a third part tool adding blocks for UAVs projects (GPS, MAVLink, Receiver S.BUS, S.Port and F.Port blocks for dsPIC). Type picInfo to find out how to install the UxV blocks.


1. download and unzip the package
2. execute the .p installer script . Within Matlab, right click on file install.p and select run.

The MCHP_example folder is created in the current folder and examples copied into.

Cite As

(Microchip Technology) MPLAB-Device-Blocks-for-Simulink

Comments and Ratings (2)

Lubin Kerhuel

Hi Deepak,

The blockset is compatible with Windows platform. It has never been tested with MAC OS and all functions related to programming, also compiling might not work properly on MAC.


Hello! Thank you for sharing MPLAB blockset.

I was trying to install it in Matlab 2018a (Mac OS 10.14.4). I am getting the following error:
Microchip Blockset 3.45 installed. See info and examples.
Save path
Update start-up matlabrc.m script
no setup for programming API required with this blockset version.
Error: MCHP Java API: cannot locate the SystemRoot folder
Tool MPLAB X not found using the registry.
Tool MPLAB X not found searching in program file folder.
Refresh cache
Register Compilers
Microchip Blockset 3.45 installed. See info and examples.

Blockset Installation done.


Start Script to clean old MPLAB X java API wrapper to program chip directly from Matlab : >>MCHP_API_Flash('remove')
Tool MDB not found using the registry.
Tool MDB not found searching in program file folder.
Tool IPE not found using the registry.
Tool IPE not found searching in program file folder.


Could you please suggest how to troubleshoot this ?

Thank you for your time :)




Updated installer. Compatible from R2010a to R2019a

MATLAB Release Compatibility
Created with R2014b
Compatible with R2014b to any release
Platform Compatibility
Windows macOS Linux