|
1 | 1 | <picture> |
2 | 2 | <source media="(prefers-color-scheme: dark)" srcset="images/microchip_logo_white_red.png"> |
3 | | - <source media="(prefers-color-scheme: light)" srcset="images/microchip_logo_black_red.png"> |
| 3 | + <source media="(prefers-color-scheme: light)" srcset="images/microchip_logo_black_red.png"> |
4 | 4 | <img alt="Microchip Logo." src="images/microchip_logo_black_red.png"> |
5 | 5 | </picture> |
6 | 6 |
|
7 | | -## matlab dspic33a curiosity simple filter example |
| 7 | +# MATLAB/Simulink Model Example Using MPLAB® Device Blocks for dsPIC33AK128MC106 Curiosity GP DIM |
8 | 8 |
|
9 | | -Board Image if any. |
| 9 | +## 1. INTRODUCTION |
10 | 10 |
|
11 | | -## Summary |
| 11 | +This document describes the setup requirements for demonstrating the use of [MPLAB Device Blocks](https://in.mathworks.com/matlabcentral/fileexchange/71892-mplab-device-blocks-for-simulink-dspic-pic32-and-sam-mcu) 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 |
| 12 | +[EV74H48A](https://www.microchip.com/en-us/development-tool/EV74H48A) "Curiosity Platform Development Board" and [EV02G02A](https://www.microchip.com/en-us/development-tool/EV02G02A) "dsPIC33AK128MC106 General Purpose Dual In-Line Module (DIM)"</p> |
12 | 13 |
|
| 14 | +## 2. SUGGESTED DEMONSTRATION REQUIREMENTS |
13 | 15 |
|
14 | | -## Related Documentation |
| 16 | +### 2.1 MATLAB Model Required for the Demonstration |
15 | 17 |
|
| 18 | +To clone or download this MATLAB model on GitHub, |
16 | 19 |
|
17 | | -## Software Used |
| 20 | +- MATLAB model can be cloned or downloaded as zip file from the Github repository ([link](https://github.com/microchip-pic-avr-solutions/matlab-dspic33a-curiosity-simple-filter-example)). |
18 | 21 |
|
| 22 | +### 2.2 Software Tools Used for Testing the MATLAB/Simulink Model |
19 | 23 |
|
20 | | -## Hardware Used |
| 24 | +- MPLAB® X IDE **v6.25** |
| 25 | +- MPLAB® XC-DSC Compiler **v3.21** |
| 26 | +- MATLAB R2024b |
| 27 | +- Required MATLAB add-on packages |
| 28 | + - Simulink (v24.2) |
| 29 | + - Simulink Coder (v24.2) |
| 30 | + - MATLAB Coder (v24.2) |
| 31 | + - Embedded Coder (v24.2) |
| 32 | + - MPLAB Device blocks for Simulink (v3.62) |
| 33 | + |
| 34 | +> **_NOTE:_** |
| 35 | +>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. |
21 | 36 |
|
| 37 | + ### 2.3 Hardware Tools Required for the Demonstration |
22 | 38 |
|
23 | | -## Setup |
| 39 | +- Curiosity Platform Development Board ([EV74H48A](https://www.microchip.com/en-us/development-tool/EV74H48A)) |
| 40 | +- dsPIC33AK128MC106 General Purpose Dual In-Line Module ([EV02G02A](https://www.microchip.com/en-us/development-tool/EV02G02A)) |
24 | 41 |
|
| 42 | +## 3. HARDWARE SETUP |
| 43 | +This section describes the hardware setup required for the demonstration. |
| 44 | +> **Note:** </br> |
| 45 | +>In this document, hereinafter Curiosity Platform Development Board is referred as **development board**. |
25 | 46 |
|
26 | | -## Operation |
| 47 | +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. |
27 | 48 |
|
| 49 | + <p align="left" > |
| 50 | + <img src="images/dimconnected.png"width="500"></p> |
28 | 51 |
|
| 52 | +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. |
29 | 53 |
|
| 54 | + The development board is also powered by this USB itself. |
| 55 | + |
| 56 | + <p align="left"> |
| 57 | + <img src="images/pkob4.png"width="500"></p> |
| 58 | + |
| 59 | +## 4. BASIC DEMONSTRATION |
| 60 | +<p style='text-align: justify;'> Follow the below instructions step-by-step, to set up and run demo application:</p> |
| 61 | + |
| 62 | +1. Launch MATLAB (refer the section [“2.2 Software Tools Used for Testing the MATLAB/Simulink Model"](#22-software-tools-used-for-testing-the-matlabsimulink-model)).</p> |
| 63 | + |
| 64 | +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"](#21-matlab-model-required-for-the-demonstration)). |
| 65 | + |
| 66 | + <p align="left" > |
| 67 | + <img src="images/dem1.png"width="500"></p> |
| 68 | + |
| 69 | +3. Double click on the example Simulink model - **Curiosity_33ak128mc106_Simple_Filter.slx**. This opens the Simulink model as shown below. |
| 70 | + |
| 71 | + <p align="left"> |
| 72 | + <img src="images/dem3.png"width="500"></p> |
| 73 | + </p> |
| 74 | + |
| 75 | + > **Note:** </br> |
| 76 | + >This example illustrates how to configure the dsPIC DSC and its peripherals through code generation using MPLAB Device blocks. Simulation is not supported. |
| 77 | + |
| 78 | +4. <p style='text-align: justify;'> This model uses the <b>External Mode</b> debug option for real time data visualization. To configure the external mode click on <b>"Ext Mode Settings" </b> option under the <b>“Microchip”</b> tab. <p style='text-align: justify;'> This will open <b>External Mode Setup</b> window and enable the checkboxes as shown in the figure. Also select the <b> COM port </b> connected to the development board and <b>Baud Rate</b>. |
| 79 | + |
| 80 | + <p align="left"> |
| 81 | + <img src="images/dem5.png"width="500"></p> |
| 82 | + </p> |
| 83 | + |
| 84 | + > **Note:** </br> |
| 85 | + >The PKOB4 based USB-UART Channel is used in this example for USB-UART communication. The development board has a 2-port USB hub. |
| 86 | +
|
| 87 | +5. <p style='text-align: justify;'> To generate the code and run the model on hardware, click on <b>"Monitor & Tune" </b> option under the <b>Hardware</b> tab and ensure that <b>"Stop Time" </b> is set to <b>"inf"</b>. |
| 88 | + |
| 89 | + <p align="left"> |
| 90 | + <img src="images/dem6.png"width="500"></p> |
| 91 | + </p> |
| 92 | +6. <p style='text-align: justify;'> After compiling the code and programming the device, External Mode will be activated on the dsPIC DSC. |
| 93 | + |
| 94 | + <p align="left"> |
| 95 | + <img src="images/dem7.png"width="500"></p> |
| 96 | + |
| 97 | + </p> |
| 98 | +7. <p style='text-align: justify;'> The <b> RGB LEB</b> will be glowing in green color and general purpose LEDs start blinking in a particular pattern. |
| 99 | + |
| 100 | + <p align="left"> |
| 101 | + <img src="images/led_rgb_green1.png"width="500"></p> |
| 102 | + </p> |
| 103 | +8. <p style='text-align: justify;'> Press the push button <b>S1</b>,to change the blinking pattern of general purpose LEDs. |
| 104 | + |
| 105 | + <p align="left"> |
| 106 | + <img src="images/led_rgb_green2.png"width="500"></p> |
| 107 | + </p> |
| 108 | +9. <p style='text-align: justify;'> Press the push button <b>S2</b>, and vary the potentiometer to change the rate of blinking. |
| 109 | + |
| 110 | + <p align="left"> |
| 111 | + <img src="images/led_rgb_green3.png"width="500"></p> |
| 112 | + </p> |
| 113 | +10. <p style='text-align: justify;'> 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. |
| 114 | + |
| 115 | + |
| 116 | + <p align="left"> |
| 117 | + <img src="images/dem9.png"width="500"></p> |
| 118 | + </p> |
| 119 | + |
| 120 | +11. Press the push button <b>S3</b>, the <b> RGB LEB</b> will be glowing in blue color and vary the potentiometer to change input signal and observe the filtered output signal in the scope view. |
| 121 | + |
| 122 | + <p align="left"> |
| 123 | + <img src="images/led_rgb_blue.png"width="500"></p> |
| 124 | + </p> |
| 125 | + |
| 126 | + <p align="left"> |
| 127 | + <img src="images/dem9_view.png"width="500"></p> |
| 128 | + </p> |
| 129 | + |
| 130 | +12. <p style='text-align: justify;'>Click on the <b>Stop</b> button to stop the external mode. |
| 131 | + |
| 132 | + <p align="left"> |
| 133 | + <img src="images/dem10.png"width="500"></p> |
| 134 | + </p> |
| 135 | + |
| 136 | + |
| 137 | +## REFERENCES: |
| 138 | +For more information, refer to the following documents or links. |
| 139 | +1. Curiosity Platform Development Board User's Guide ([DS70005562](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU16/ProductDocuments/UserGuides/Curiosity-Platform-Development-Board-Users-Guide-DS70005562.pdf)) |
| 140 | +2. dsPIC33AK128MC106 General Purpose Dual In-Line Module (DIM) Information Sheet ([DS70005556](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU16/ProductDocuments/InformationSheet/dsPIC33AK128MC106-General-Purpose-DIM-Info-Sheet-DS70005556.pdf)) |
| 141 | +3. dsPIC33AK128MC106 Family datasheet ([DS70005539](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU16/ProductDocuments/DataSheets/dsPIC33AK128MC106-Family-Data-Sheet-DS70005539.pdf)) |
| 142 | +4. MPLAB® X IDE User’s Guide ([DS50002027](https://ww1.microchip.com/downloads/en/DeviceDoc/50002027E.pdf) or [MPLAB® X IDE help](https://microchipdeveloper.com/xwiki/bin/view/software-tools/x/)) |
| 143 | +5. [MPLAB® X IDE installation](http://microchipdeveloper.com/mplabx:installation) |
| 144 | +6. [MPLAB® XC-DSC Compiler installation](https://developerhelp.microchip.com/xwiki/bin/view/software-tools/xc-dsc/install/) |
| 145 | +7. [MPLAB Device Blocks for Simulink :dsPIC, PIC32 and SAM mcu](https://in.mathworks.com/matlabcentral/fileexchange/71892-mplab-device-blocks-for-simulink-dspic-pic32-and-sam-mcu) |
| 146 | +8. [External Mode Demo](https://www.microchip.com/en-us/about/media-center/videos/wuzLmORk1M0) |
0 commit comments