We detect you are using an unsupported browser. For the best experience, please visit the site using Chrome, Firefox, Safari, or Edge. X

Motor Control Simplified


Prototyping your next motor control design doesn’t have to be hard. We offer a rapid prototyping solution that allows you to compile and flash a Simulink model of a motor control system into a dsPIC33 DSC or a PIC32 MCU with a single push of a button. Our Simulink blocksets and models support our devices and development boards for a complete hardware and software motor control solution.

 Six Steps to Simplify Your Motor Control Development


Step 1: Make sure that MPLAB® X Integrated Development Environment (IDE) and the Simulink tools are installed on your computer

System Requirements

For simulation, you will need

  • MATLAB R2013a or later, 32-bit or 64-bit Windows® operating system
  • Simulink
  • Fixed-Point Designer™

For code generation, you will also need

  • Simulink Coder™
  • MATLAB Coder™
  • Embedded Coder®

Compilation and programming of the code generated with this blockset requires the latest MPLAB® XC compiler and MPLAB X Integrated Development Environment (IDE).

Step 2: Build your Simulink model using:

Simulation blocks and code generation for motor control algorithms

Blocks for PWMs, ADCs and other peripherals for use in simulation and code generation

Used to simulate PMSM motor in Simulink

Step 3: Generate code using the Simulink embedded code generator

Step 4: Compile the MPLAB X IDE project and load code onto target MCU or DSCs

Demo examples are available for the following motor control development boards:

dsPICDEM™ MCHV-3 High-Voltage Motor Control Development Board

dsPICDEM MCLV-2 Low-Voltage Motor Control Development Board

Step 5: Connect your board to your motor

Step 6: Run your code to spin a motor

Other Helpful Resources


Motor Control with Embedded Coder® for Microchip MCUs

This webinar demonstrates how to use Simulink to generate motor control code for a dsPIC33EP DSC-based system

dsPIC33 Motor Control DSCs

Explore our portfolio of dsPIC33 devices with specialized motor control peripherals

MATLAB and Simulink Components from Microchip

Motor Control Library Blockset for MATLAB and Simulink


Simulation blocks and code generation for motor control algorithms

The Motor Control Library blockset contains several basic Simulink blocks that can be used to jump start model-based design of your motor control applications using the dsPIC33 family of DSCs and the PIC32MK and SAM E70 families of 32-bit MCUs. These blocks include reference frame transforms, a Proportional-Integral (PI) controller and trigonometric functions, all of which can be used with the Embedded Coder to generate efficient code by utilizing our Motor Control Library.

Print

Installation:

  • Download the Motor Control Library blockset
  • Unzip the archive file into a directory of your choice
  • Add this directory into the MATLAB search path, which makes the Motor Control Library Blockset appear in the Simulink Library Browser the next time you start MATLAB

Usage:

  • These blocks may be placed in a Simulink model like any other Simulink block
  • For best results in code generation, turn on Inline Parameters
  • The Proportional-Integral (PI) controller block requires mchp_MC_PISTATE_T in the MATLAB base workspace to contain a particular structure definition, which can be automatically set up by creating the required structure in the Simulink model's InitFcn
    • In a Simulink model using the Motor Control Library Blockset, select File > Model Properties > Model Properties > Callbacks > InitFcn
    • Add the ‘mchp_MC_PISTATE_T’ statement to the model initialization function shown in the InitFcn dialog box
    • Save the Simulink model
    • These steps need to be followed only once per new model file

Block Listing

Block Name Block Description
Clarke:ab-to-alphabeta
 

Clarke transform (ab → αβ)
2 → 2 transform from per-phase measurements (ab) to stationary orthogonal (αβ) reference frame
ClarkeInv:alphabeta-to-abc:input-swap Inverse Clarke transform (αβ → abc)
2 → 3 transform from stationary orthogonal (αβ) reference frame to per-phase values (abc)
Legacy form with swapped inputs
Park:alphabeta-to-dq Park transform (αβ → dq)
2 → 2 transform from stationary orthogonal (αβ) reference frame to rotating (dq) reference frame
ParkInv:dq-to-alphabeta Inverse Park transform (dq → αβ)
2 → 2 transform from rotating (dq) reference frame to stationary orthogonal (αβ) reference frame
PI-controller:antiwindup Proportional-integral controller with antiwindup
Sincos:table-interp Sine and cosine calculation (table-based with interpolation)
Arctan2:CORDIC Arctangent (xy → θ)
Compute angle of input coordinates (x,y) using the CORDIC algorith
SVM-generator:gain-and-phase-shift Space vector modulation
Legacy form, with gain and phase shift

MPLAB Device Blocks for Simulink


Code generation blocks for dsPIC33 DSCs and PIC32 and SAM7x support package for Embedded Coder

Create stand-alone applications from a Simulink discrete time model and with just one click generate, compile and load the code for your application onto your target device. The MPLAB Device Blocks for Simulink is a free set of user interfaces and Simulink peripheral blocks for developing complex designs based on dsPIC33 Digital Signal Controllers (DSCs) and PIC32 and SAM E70 microcontrollers (MCUs). The package also includes many examples in the form of demo models to further simplify your development, including a complete BLDC motor control application.

Supported Peripherals:

  • Digital I/Os
  • Analog-to-Digital Converters (ADCs)
  • Motor control Pulse-Width Modulators (PWMs)
  • Interrupts, resets and change notifications
  • Output Compares (OCs) and Input Captures (ICs)
  • Quadrature Encoder Interfaces (QEIs)
  • I2C, SPI and UART communication

PMSM Simulink Motor Model


Simulate a PMSM Motor in Simulink

Our PMSM Motor Model blockset is a set of components to be used with the Simulink simulation tool. These blocks allow you to model a closed-loop control system of a PMSM using our range of MCUs and dsPIC33 DSCs. This PMSM model assists in your development, testing and understanding of motor control systems based on your motor’s specification. You can use this free simulation block to confirm the behavior of real systems and explore the system behavior under conditions that are impossible or cumbersome to test in the real world.

Products

We're having trouble displaying information on this page right now. Please visit our Parametric Chart tool to search these products and their data.
We're having trouble displaying information on this page right now. Please visit our Parametric Chart tool to search these products and their data.
We're having trouble displaying information on this page right now. Please visit our Parametric Chart tool to search these products and their data.
We're having trouble displaying information on this page right now. Please visit our Parametric Chart tool to search these products and their data.
We're having trouble displaying information on this page right now. Please visit our Parametric Chart tool to search these products and their data.

Documentation

Title Download
AN1162 - Sensorless Field Oriented Control (FOC) of an AC Induction Motor (ACIM) Download
AN1206 - Sensorless Field Oriented Control (FOC) of an AC Induction Motor (ACIM) Using Field Weakening Download
AN1292 - Sensorless Field Oriented Control (FOC) for a Permanent Magnet Synchronous Motor (PMSM) Using a PLL Estimator and Field Weakening (FW) Download
AN1305 - Sensorless 3-Phase Brushless Motor Control with the PIC16FXXX Download
AN2520 - Sensorless Field Oriented Control (FOC) for a Permanent Magnet Synchronous Motor (PMSM) Using a PLL Estimator and Equation-based Flux Weakening (FW) Application Note Download
Title Download
Motor Control and Drive Brochure Download
Title Download
CE002 Configuring 10-Bit dsPIC DSC A/D Converters for 1 Msps Conversion Rate Download
CE019 - Proportional Integral Derivative (PID) controllers & closed-loop control Download
CE155 - Real-Time Data Monitoring (RTDM) Example Download
PFC Sensorless FOC PLL Estimator MCHV Download
Sensorless FOC PLL Estimator MCLV Download
Title Download
dsPIC33 Motor Control Library for FOC Download
Title Download
dsPICDEM™ MCLV-2 Development Board User’s Guide Download
dsPICDEM™ MCSM Development Board User’s Guide Download
Motor Control Starter Kit User’s Guide Download
dsPICDEM™ MCHV-2 Development Board User’s Guide Download
Title Download
WP100 - How to Turn an AC Induction Motor Into a DC Motor (A Matter of Perspective) Download

Title

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum vehicula velit sit amet turpis rutrum vehicula. Donec eu varius velit, nec ultricies arcu. Fusce vitae pulvinar lorem. Etiam sodales et ipsum volutpat suscipit. Aliquam non mauris ut lectus volutpat feugiat id eget massa. Aliquam vel eleifend metus. Nam ultricies, risus sed tempor suscipit, dolor ligula sodales erat, et porta magna sem fermentum felis. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec commodo magna at scelerisque sollicitudin. Morbi elit tortor, blandit vel imperdiet in, ullamcorper eu tortor. Etiam dapibus eleifend elementum. Vestibulum finibus efficitur mauris, vitae convallis ex molestie non. Etiam luctus at mauris accumsan finibus.