Skip to content

MATLAB/Simulink Model Example Using MPLAB Device Blocks on the hardware platform Curiosity Platform Development Board and dsPIC33AK128MC106 GP DIM

License

Notifications You must be signed in to change notification settings

microchip-pic-avr-examples/matlab-dspic33a-curiosity-simple-filter-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microchip Logo.

MATLAB/Simulink Model Example Using MPLAB® Device Blocks for dsPIC33AK128MC106 Curiosity GP DIM

1. INTRODUCTION

This document describes the setup requirements for demonstrating the use of MPLAB Device Blocks to configure and operate the dsPIC Digital Signal Controller (DSC) and its peripherals within a MATLAB/Simulink model. The example is developed using the hardware platform EV74H48A "Curiosity Platform Development Board" and EV02G02A "dsPIC33AK128MC106 General Purpose Dual In-Line Module (DIM)"

2. SUGGESTED DEMONSTRATION REQUIREMENTS

2.1 MATLAB Model Required for the Demonstration

To clone or download this MATLAB model on GitHub,

  • MATLAB model can be cloned or downloaded as zip file from the Github repository (link).

2.2 Software Tools Used for Testing the MATLAB/Simulink Model

  • MPLAB® X IDE v6.25
  • MPLAB® XC-DSC Compiler v3.21
  • MATLAB R2024b
  • Required MATLAB add-on packages
    • Simulink (v24.2)
    • Simulink Coder (v24.2)
    • MATLAB Coder (v24.2)
    • Embedded Coder (v24.2)
    • MPLAB Device blocks for Simulink (v3.62)

NOTE: The software tools used for testing the model during release is listed above. It is recommended to use the version listed above or later versions for building the model.

2.3 Hardware Tools Required for the Demonstration

  • Curiosity Platform Development Board (EV74H48A)
  • dsPIC33AK128MC106 General Purpose Dual In-Line Module (EV02G02A)

3. HARDWARE SETUP

This section describes the hardware setup required for the demonstration.

Note:
In this document, hereinafter Curiosity Platform Development Board is referred as development board.

  1. Insert the dsPIC33AK128MC106 Curiosity GP DIM into the DIM Interface connector J1 on the development board. Make sure the DIM is placed correctly and oriented before going ahead.

  2. The development board has an onboard programmer PICkit™ On Board (PKoBv4) , which can be used for programming or debugging the microcontroller or dsPIC DSC on the DIM. To use the onboard programmer, connect a Micro-C® cable between the Host PC and connector J24 on the development board.

    The development board is also powered by this USB itself.

4. BASIC DEMONSTRATION

Follow the below instructions step-by-step, to set up and run demo application:

  1. Launch MATLAB (refer the section “2.2 Software Tools Used for Testing the MATLAB/Simulink Model").

  2. Open the folder downloaded from the repository, in which MATLAB files are saved (refer the section "2.1 MATLAB Model Required for the Demonstration").

  3. Double click on the example Simulink model - Curiosity_33ak128mc106_Simple_Filter.slx. This opens the Simulink model as shown below.

    Note:
    This example illustrates how to configure the dsPIC DSC and its peripherals through code generation using MPLAB Device blocks. Simulation is not supported.

  4. This model uses the External Mode debug option for real time data visualization. To configure the external mode click on "Ext Mode Settings" option under the “Microchip” tab.

    This will open External Mode Setup window and enable the checkboxes as shown in the figure. Also select the COM port connected to the development board and Baud Rate.

    Note:
    The PKOB4 based USB-UART Channel is used in this example for USB-UART communication. The development board has a 2-port USB hub.

  5. To generate the code and run the model on hardware, click on "Monitor & Tune" option under the Hardware tab and ensure that "Stop Time" is set to "inf".

  6. After compiling the code and programming the device, External Mode will be activated on the dsPIC DSC.

  7. The RGB LEB will be glowing in green color and general purpose LEDs start blinking in a particular pattern.

  8. Press the push button S1,to change the blinking pattern of general purpose LEDs.

  9. Press the push button S2, and vary the potentiometer to change the rate of blinking.

  10. To visualize the input and filtered output signals, double-click the Scope in the model to launch the scope view.The filter input is set to a 1Hz pulse by default.

  11. Press the push button S3, the RGB LEB will be glowing in blue color and vary the potentiometer to change input signal and observe the filtered output signal in the scope view.

  12. Click on the Stop button to stop the external mode.

REFERENCES:

For more information, refer to the following documents or links.

  1. Curiosity Platform Development Board User's Guide (DS70005562)
  2. dsPIC33AK128MC106 General Purpose Dual In-Line Module (DIM) Information Sheet (DS70005556)
  3. dsPIC33AK128MC106 Family datasheet (DS70005539)
  4. MPLAB® X IDE User’s Guide (DS50002027 or MPLAB® X IDE help)
  5. MPLAB® X IDE installation
  6. MPLAB® XC-DSC Compiler installation
  7. MPLAB Device Blocks for Simulink :dsPIC, PIC32 and SAM mcu
  8. External Mode Demo

About

MATLAB/Simulink Model Example Using MPLAB Device Blocks on the hardware platform Curiosity Platform Development Board and dsPIC33AK128MC106 GP DIM

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published