File Exchange

image thumbnail

MPLAB Device Blocks for Simulink :dsPIC, PIC32 and SAM mcu

version 3.45.05 (8.48 MB) by Lubin Kerhuel
Microchip support package for Embedded Coder


Updated 04 Oct 2019

GitHub view license on GitHub

MPLAB Device Blocks for Simulink enables Embedded Coder for automated build and execution of real-time executable for any board equipped with a dsPIC (r), PIC32 (r) or SAMx7 from a Simulink model.


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


Built-in scheduler including single-tasking and multi-tasking option for multi-rate models.

Advanced configuration of ADC / PWM peripheral enable PMSM motor algorithm where ADC sample time is 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.

Cite As

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

Comments and Ratings (3)

How does this MPlab Block Set Work? How does one obtain this embedded coder or is it needed. The fact that we need all these tools. Can we use other toolboxes with this MPlab. I would like to use fmincon and other toolboxs with this design.


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 :)




- fixed QEI typo in generated code (PIC32)
- fixed SPI typo on slave implementation (PIC32)


- PIL and Ext-Mode GUI issue UART
- PIC32 Compiler block issue with heap size
- PIC32 code for Timer might not compile

- Improved MPLAB X project creation
- Added Ext-Mode example for PIC32MZ


- Extended supported chip
- Added programming interface user choice (MDB vs IPE)
- Improved support for SNAP and PICKIT 4 programmers
- Fixed some compatibility issue with older Matlab release
Other minor improvements, see file


Updated installer. Compatible from R2010a to R2019a

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