|
1 |
| - |
| 1 | + |
2 | 2 |
|
3 | 3 | # dsPIC33C High-Resolution PWM Configuration I
|
| 4 | + |
4 | 5 | **Complementary PWM Waveform Generation**
|
5 | 6 |
|
6 | 7 | <p><center><a target="_blank" href="https://www.microchip.com/MA330048" rel="nofollow">
|
|
9 | 10 | - - -
|
10 | 11 |
|
11 | 12 | ## Summary
|
12 |
| -Learning how to use the High Resolution PWM Module of dsPIC33C MP devices |
13 | 13 |
|
14 |
| -Lab 1: Complementary Waveform Generation |
| 14 | +Learn how to use the High Resolution PWM Module of dsPIC33C MP devices |
| 15 | + |
| 16 | +**Lab 1: Complementary Waveform Generation** |
15 | 17 | Code example for dsPIC33CK and dsPIC33CH devices introducing the basic configuration of the high-resolution PWM module using one PWM generator channel generating a single, complementary PWM waveform
|
16 | 18 |
|
17 | 19 | - - -
|
18 | 20 |
|
19 | 21 | ## Related Documentation
|
20 |
| -- [dsPIC33CK256MP508 Family Data Sheet](https://ww1.microchip.com/downloads/en/DeviceDoc/dsPIC33CK256MP508-Family-Data-Sheet-DS70005349G.pdf) |
21 |
| -- [dsPIC33CK256MP508 Family Silicon Errata and Data Sheet Clarification](https://ww1.microchip.com/downloads/en/DeviceDoc/dsPIC33CK256MP508-Family-Silicon-Errata-and-Data-Sheet-Clarification-DS80000796G.pdf) |
| 22 | + |
| 23 | +- [dsPIC33CK256MP508 Family Data Sheet](https://www.microchip.com/DS70005349) |
| 24 | +- [dsPIC33CK256MP508 Family Silicon Errata and Data Sheet Clarification](https://www.microchip.com/80000796) |
22 | 25 |
|
23 | 26 | Alternative Controller Plug-In Module:
|
24 |
| -- [dsPIC33CH512MP508 Family Data Sheet](http://ww1.microchip.com/downloads/en/DeviceDoc/dsPIC33CH512MP508-Family-Data-Sheet-DS70005371D.pdf) |
25 |
| -- [dsPIC33CH512MP508 Family Silicon Errata and Data Sheet Clarification](http://ww1.microchip.com/downloads/en/DeviceDoc/dsPIC33CH512MP508-Family-Silicon-Errata-and-Data-Sheet-Clarification-DS80000805F.pdf) |
| 27 | + |
| 28 | +- [dsPIC33CH512MP508 Family Data Sheet](http://www.microchip.com/70005371) |
| 29 | +- [dsPIC33CH512MP508 Family Silicon Errata and Data Sheet Clarification](http://www.microchip.com/80000805) |
26 | 30 |
|
27 | 31 | **Please always check for the latest data sheets on the respective product websites:**
|
| 32 | + |
28 | 33 | - [dsPIC33CK256MP508 Family](https://www.microchip.com/dsPIC33CK256MP508)
|
29 | 34 | - [dsPIC33CH512MP508 Family](https://www.microchip.com/dsPIC33CH512MP508)
|
30 | 35 |
|
31 |
| -## Software Used |
32 |
| -- [MPLAB® X IDE v5.40](https://www.microchip.com/mplabx-ide-windows-installer) |
33 |
| -- [MPLAB XC16 Compiler v1.50](https://www.microchip.com/mplabxc16windows) |
34 |
| -- [Microchip Code Configurator v3.95](https://www.microchip.com/mplab/mplab-code-configurator) |
| 36 | +## Software Used |
| 37 | + |
| 38 | +- [MPLAB® X IDE v6.05](https://www.microchip.com/mplabx) |
| 39 | +- [MPLAB® XC16 Compiler v2.00](https://www.microchip.com/xc16) |
| 40 | +- [MPLAB® Code Configurator v4.85](https://www.microchip.com/mcc) |
35 | 41 |
|
36 | 42 | ## Hardware Used
|
| 43 | + |
37 | 44 | - Digital Power Development Board, Part-No. [DM330029](https://www.microchip.com/DM330029)
|
38 | 45 | - dsPIC33CK Digital Power Plug-In Module (DP PIM), Part-No. [MA330048](https://www.microchip.com/MA330048)
|
39 | 46 | - Alternatively: dsPIC33CH Digital Power Plug-In Module (DP PIM), Part-No. [MA330049](https://www.microchip.com/MA330049)
|
40 | 47 |
|
41 | 48 | ## Supported Target Devices
|
| 49 | + |
42 | 50 | - [dsPIC33CK256MP506](https://www.microchip.com/dsPIC33CK256MP506)
|
43 | 51 | - [dsPIC33CH512MP506](https://www.microchip.com/dsPIC33CH512MP506)
|
44 | 52 | - Code compatible with all Single and Dual Core dsPIC33C MP families of devices
|
45 | 53 |
|
46 | 54 | - - -
|
47 | 55 |
|
48 | 56 | ## Setup
|
| 57 | + |
49 | 58 | - Plug-In the dsPIC33CK Digital Power Plug In Module into the Digital Power Development Board PIM socket J1
|
50 | 59 | - Open and compile the firmware and program the DSC
|
51 | 60 |
|
52 |
| -<br><center><img src="images/dm330029.jpg" width="400"></center> |
| 61 | +<p><center><img src="images/dm330029.jpg" width="500"></center></p> |
53 | 62 |
|
54 | 63 | ## Operation
|
| 64 | + |
55 | 65 | After the device has been programmed and the MCU starts up, PWM generator #3 is generating a 200 kHz complementary waveform at the PWM3H/PWM3L outputs.
|
56 | 66 |
|
57 |
| -<br><center><img src="images/pwm200kHz.png" width="400"></center><br> |
| 67 | +<p><center><img src="images/pwm200kHz.png" width="500"></center></p> |
58 | 68 | *200 kHz Switching Frequency Output*
|
59 | 69 |
|
60 | 70 | By pressing the on-board push button *USER* on the Digital Power Development Board, the switching frequency is toggled between the initial 200 kHz and 1 MHz.
|
61 |
| -<br><center><img src="images/pwm1MHz.png" width="400"></center><br> |
| 71 | +<p><center><img src="images/pwm1MHz.png" width="500"></center></p> |
62 | 72 | *1 MHz Switching Frequency Output*
|
63 | 73 |
|
64 |
| - |
65 | 74 | Please refer to section *FIRMWARE QUICK-START GUIDE* below for more information on the initialization process and code structure.
|
66 | 75 |
|
67 |
| -<br><center><img src="images/dm330029-pinmap.png" width="800"></center><br> |
68 |
| - |
| 76 | +<p><center><img src="images/dm330029-pinmap.png" width="800"></center></p> |
| 77 | + |
69 | 78 | - - -
|
70 | 79 |
|
71 | 80 | ## FIRMWARE QUICK-START GUIDE
|
72 | 81 |
|
73 |
| -This code example builds on previous code examples showing how to use Microchip Code Configurator (MCC) to set up device clock domains. |
74 |
| -Although MCC also supports configuration tools for the High Resolution PWM module, PWM configuration in this example builds on generic peripheral drivers to help users better understand the peripheral architecture and key aspects of specific configurations and operating modes. |
| 82 | +This code example builds on previous code examples showing how to use Microchip Code Configurator (MCC) to set up device clock domains. |
| 83 | + |
| 84 | +Although MCC also supports configuration tools for the High Resolution PWM module, PWM configuration in this example builds on generic peripheral drivers to help users better understand the peripheral architecture and key aspects of specific configurations and operating modes. |
| 85 | + |
75 | 86 | In each PWM example code project the PWM configuration procedure is located in the user file pwm.c, where each register bit required to achieve/enable the specific function or mode of interest is set and its function described with comments.
|
76 | 87 | Once users are familiar with the architecture, features and capabilities, both configuration options (generic peripheral library or MCC) may be used.
|
77 | 88 |
|
78 |
| -*a) Project Directory Structure* |
| 89 | +### a) Project Directory Structure |
| 90 | + |
79 | 91 | The project contains two sub-directories
|
| 92 | + |
80 | 93 | - config: location of all hardware abstraction header files
|
81 |
| -- drivers: location of generic peripheral drivers |
| 94 | +- drivers: location of generic peripheral drivers |
82 | 95 | - MCC Generated Files: all device configuration files auto-generated by MCC
|
83 | 96 | - root: application user code
|
84 | 97 |
|
85 |
| -On the hard drive, main.c/h are located in the MPLAB X project directory. |
86 |
| -All other user files, incl. peripheral drivers, are located in the sub-directory *sources*. |
87 |
| -Files generated by MCC are always located in their own sub-directory *mcc_generated-files* |
| 98 | +On the hard drive, main.c/h are located in the MPLAB® X project directory. |
| 99 | +All other user files, incl. peripheral drivers, are located in the sub-directory *sources*. |
| 100 | +Files generated by MCC are always located in their own sub-directory *mcc_generated-files* |
| 101 | + |
| 102 | +### b) Using the generic PWM peripheral driver |
88 | 103 |
|
89 |
| -*b) Using the generic PWM peripheral driver* |
90 | 104 | The PWM peripheral driver files p33c_pwm.c/h provide data structures representing the Special Function Register (SFR) sets of PWM generators and the PAM base module. These 'virtual' PWM objects are used to load, read and modify PWM generator configurations without the need to hard-coded instructions, which would make the code hard to migrate from one peripheral to another or even across devices.
|
91 | 105 | To simplify PWM configurations, in these examples, each register is reset to a known default state before the user configuration of interest is set. Thus, only the register setting which really matter for a certain features/function are shown.
|
92 | 106 |
|
93 | 107 | To learn more about the generic PWM driver, its supported features and intended use cases, please read the comments inside p33c_pwm.c.
|
94 | 108 |
|
95 |
| -*c) Executing the Code Example* |
96 |
| -This code has been written to automatically start up and perform the function of interest. Please read the demo instructions on top of file main.c to learn more about the code example, test points, expected signals and demo mode operation. |
97 |
| - |
| 109 | +### c) Executing the Code Example |
98 | 110 |
|
| 111 | +This code has been written to automatically start up and perform the function of interest. Please read the demo instructions on top of file main.c to learn more about the code example, test points, expected signals and demo mode operation. |
99 | 112 |
|
100 |
| -- - - |
| 113 | +- - - |
101 | 114 |
|
102 |
| -© 2020, Microchip Technology Inc. |
| 115 | +© 2023, Microchip Technology Inc. |
0 commit comments