MPLAB Device Blocks for Simulink

Model-Based Design for Microchip Microcontrollers

Welcome to the MPLAB Device Blocks for Simulink Documentation

The MPLAB Device Blocks for Simulink is a comprehensive toolkit developed by Microchip Technology that integrates seamlessly with MATLAB/Simulink environment. It enables engineers to design, simulate, and automatically generate embedded C code for a wide range of Microchip microcontrollers.

With one-button code generation and deployment, the blockset dramatically shortens the simulation โ†” test iteration cycle, allowing you to focus on algorithm development rather than low-level programming and 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 you 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 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 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 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

If you need assistance or want 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