Welcome to the MPLAB Device Blocks for Simulink Documentation

Model-Based Design for Microchip Microcontrollers

The MPLAB Device Blocks for Simulink is a comprehensive blockset developed by Microchip Technology that integrates seamlessly with the MATLAB/Simulink environment. It enables engineers to generate embedded C code from a Simulink model for a wide range of Microchip microcontrollers.

Three core capabilities close the simulation โ†” hardware loop in a single workflow:

  • One-button code generation and deployment shorten the simulation โ†” test iteration cycle.
  • Real-time data logging and visualisation capture hardware measurements and internal variables.
  • Engineers focus on control-algorithm development through simulation tools. No waste of time on low-level programming or microcontroller configuration.

Key Features

  • Wide Device Support: Over 250 dsPIC and PIC32 microcontrollers supported
  • Automatic Code Generation: One-click translation from Simulink model to embedded C code
  • Peripheral Configuration: Easy-to-use blocks for configuring PWM, ADC, UART, SPI, I2C, CAN, Timers, and more
  • Multi-Tasking Scheduler: Built-in rate monotonic scheduler for real-time applications
  • Hardware-in-the-Loop: External mode and Processor-in-the-Loop (PIL) testing capabilities
  • Optimized Code: Assembly code replacements for critical functions on dsPIC family
  • MPLAB Integration: Automatic project generation for MPLAB X IDE
  • Real-Time Debugging: UART-based data logging and visualization with picgui interface

Documentation Sections

Getting Started

Quick start guides, installation instructions, and basic tutorials to get up and running quickly.

View Getting Started โ†’

Block Reference

Complete catalog of all available blocks organized by category: System, Digital IO, PWM, ADC, Communication, Timers, and more.

Browse Blocks โ†’

User Guide

Detailed guides for code generation, compiler setup, external mode debugging, and PIL testing.

Read User Guide โ†’

Motor Control

Specialized guide for motor control applications including FOC algorithms, field weakening, and sensorless control techniques.

Explore Motor Control โ†’

Examples

University research projects and Microchip Discover examples covering motor control, peripherals, and development boards.

See Examples โ†’

Video Tutorials

Watch webinars and tutorials from MathWorks, Microchip, and university researchers covering motor control, power electronics, and code deployment.

Watch Videos โ†’

Troubleshooting

Common issues and solutions for compilation errors, external mode problems, and hardware connection troubleshooting.

Get Help โ†’

Supported Device Families

dsPIC33A (NEW)

32-bit DSC with FPU, advanced PWM with Fine Edge Placement (FEP), enhanced security features.

dsPIC33C/CH/CK/CDV

16-bit DSC with dual-core options, standard PWM, motor control capabilities.

dsPIC33E/EP

16-bit DSC with high-speed SAR ADC, motor control peripherals, extensive peripheral set.

dsPIC33F/FJ

16-bit DSC foundation with motor control PWM, standard ADC, legacy applications.

dsPIC30F

16-bit DSC legacy family, essential peripheral support for existing applications.

PIC32 (MK/MZ/MX)

32-bit MIPS-based microcontrollers with motor control PWM, advanced peripherals.

SAM (ARM Cortex-M)

ARM-based microcontrollers: SAME5x, SAME7x, SAMC2x, SAMD2x families.

View Full List

See the complete list of supported devices with detailed specifications and capabilities.

Supported Devices โ†’

How It Works

During the code generation process, the MPLAB Device Blocks for Simulink automatically handles:

  • Microcontroller initialization and configuration based on the selected target device
  • Peripheral driver code generation (PWM, ADC, communication interfaces, etc.)
  • Multi-tasking scheduler implementation with configurable overload handling
  • Complete C code compilation using XC16, XC32, or XC-DSC compilers
  • Generation of ready-to-flash binary files (.hex, .elf, .cof formats)
  • Automatic programming of the target microcontroller (optional)
  • MPLAB 8 and MPLAB X project file creation for further development

Target Applications

โšก Motor Control

PMSM/BLDC control, FOC algorithms, sensorless control, field weakening.

๐Ÿ”‹ Power Supplies

Digital power conversion, PFC, inverters, DC-DC converters.

๐Ÿญ Industrial Automation

PLC applications, sensor interfaces, communication protocols.

๐ŸŽ›๏ธ Control Systems

Real-time control loops, signal processing, data acquisition.

Getting Help

For assistance or to learn more:

  • Documentation: Browse the comprehensive guides in this documentation
  • Video Tutorials: Watch video tutorials for step-by-step guidance
  • Troubleshooting: Check the Troubleshooting Guide for common issues
  • Examples: Study the included examples for practical implementations
  • External Resources: Visit ctrl-elec.fr for advanced motor control tutorials
  • Community: Join discussions on Microchip community forums
  • Technical Support: Contact Microchip technical support for device-specific questions