MPLAB® Device Blocks for Simulink®

Last modified by Microchip on 2023/11/09 09:10

What is MPLAB® Device Blocks for Simulink®?

Simulink and Microchip dsPIC logosMPLAB® Device Blocks for Simulink® provides a set of user interfaces and Simulink peripheral blocks for the dsPIC30, dsPIC33 Digital Signal Controllers (DSCs), and the PIC32MK MCUs.

Standalone applications can be created from a Simulink discrete-time model by adding blocks provided by Microchip. Code for the application is generated, compiled, and loaded on a target in a single, one-push-button step.


  • Generates efficient single-tasking and multi-tasking code
  • Target configuration blocks: Master Block, Simulink Reset Config, Compiler Option, Datasheet
  • Peripherals configuration blocks for dsPIC30, dsPIC33 DSCs, PIC32MK, and PIC32MZ MCUs:
    • Digital I/O
    • Analog-to-Digital Converter (ADC)
    • Pulse Width Modulation (PWM)
    • Change Notification
    • Output Compare
    • Input Capture
    • Quadrature Encoder Interfaces (QEI)
    • I²C
    • Serial Peripheral Interface (SPI)
    • UART
    • Interrupt
    • Reset
  • Facility to invoke dsPIC30, dsPIC33 DSCs, PIC32MK, and PIC32MZ MCUs coded functions written in C through the C Function Call block
  • Support external mode to connect target to Simulink, visualize signals, and tune parameters while running in real-time
  • Support Processor In the Loop (PIL) for fine analysis of code execution (timing and accuracy)
  • Real-time view/analyze/log variables of a standalone running model through our custom PIC® GUI interface
  • Generates a ready-to-use MPLAB X IDE project
  • Supports over 270 devices


MPLAB Device Blocks for Simulink is a block set developed by Microchip that integrates within the MATLAB®/Simulink environment. It contains a suite of blocks added to the Simulink Library and scripts for MATLAB that allows the configuration of a microcontroller and its peripherals. It also provides the ability to design complex algorithms using tools such as Simulink instead of hand-coding. This facility enables designers to go back and forth from high-level simulation to real hardware tests efficiently removing the burden of low-level programming tasks.

Simulink library window

The Library

MPLAB Device Blocks for Simulink make it easy to develop complex designs using Microchip’s dsPIC30, dsPIC33, PIC32MK, and PIC32MZ Digital Signal Controllers (DSCs). This support package provides a set of user interfaces to the MathWorks® Simulink graphical environment for simulation and model-based design, where the code for the application is generated, compiled, and loaded onto a target in a single, one-click step.

This block set also includes multi-rate and interrupt-capable device blocks and provides complete, model-based control of most dsPIC® and PIC32MK DSCs on-chip peripherals for greater flexibility and higher utilization, including the following:

  • Digital I/Os
  • Analog-to-Digital Converters (ADC)
  • Pulse Width Modulations (PWM)
  • Change notifications
  • Output compares
  • Input captures
  • Quadrature Encoder Interfaces (QEI)
  • Interrupts and resets

It also includes communication interfaces such as I²C, Serial Peripheral Interface (SPI), and UARTs. Additionally, designers can monitor, tune, log, and instrument their algorithms and applications in real-time, via features like External mode, Processor in the Loop (PIL), and our PIC GUI interface.

The Device Blocks are also simple to set up and one Simulink model can be easily modified to target any dsPIC DSC, which enables easy in-process design changes and seamless migration. The Code Replacement Library (CRL), enabled in one click, replaces parts of the MathWorks generated code by its Microchip fast implementation counterpart, which takes advantage of the chip-specialized architecture. The Device Blocks’ facility to invoke dsPIC33/PIC32MK/PIC32MZ dedicated functions written in C (via a C function-call block) allow designers to add their custom driver or to use one of Microchip’s numerous application, algorithm, and operation libraries directly from a Simulink model.