1.20 MCPWM Channels
This example demonstrates how to use the MCPWM peripheral to generate PWM signals.
Description
This example shows how to configure the MCPWM to generate PWM signals whose duty and period can be configured independently.
Downloading and Building the Application
To clone or download this application from Github, go to the main page of this repository and then click Clone button to clone this repository or download as zip file. This content can also be downloaded using content manager by following these instructions.
Path of the application within the repository is apps/mcpwm/mcpwm_channels/firmware .
To build the application, refer to the following table and open the project using its IDE.
Project Name | Description |
---|---|
pic32mk_mcj_curiosity_pro.X | MPLABX project for PIC32MK MCJ Curiosity Pro Board |
pic32mk_mca_curiosity_pro.X | MPLABX project for PIC32MK MCA Curiosity Pro Board |
Setting Up the Hardware
The following table shows the target hardware for the application projects.
Project Name | Description |
---|---|
pic32mk_mcj_curiosity_pro.X | PIC32MK MCJ Curiosity Pro Board |
pic32mk_mca_curiosity_pro.X | PIC32MK MCA Curiosity Pro Board |
Setting Up PIC32MK MCJ Curiosity Pro Board
- Connect the Debug USB port on the board to the computer using a micro USB cable
Setting Up PIC32MK MCA Curiosity Pro Board
- Connect the Debug USB port on the board to the computer using a micro USB cable
Running the Application
- Build and program the application project using its IDE
- Observe the high-side and low-side PWM waveforms on the oscilloscope
- Observe the dead time between the high side and low side
- Refer to the table below for PWM channels oscilloscope connections:
PWM Channel Pin For PIC32MK MCJ Curiosity Pro Board Pin For PIC32MK MCA Curiosity Pro Board PWM1H RPB14 (Pin 7 of J501 ) RPB14 (Pin 19 of J601 ) PWM1L RPB15 (Pin 8 of J501 ) RPB15 (Pin 21 of J601 ) PWM2H RPB12 (Pin 7 of J502 ) RPB12 (Pin 22 of J601 ) PWM2L RPB13 (Pin 8 of J502 ) RPB13 (Pin 23 of J601 ) PWM3H RPB10 (Pin 7 of J503 ) RPB10 (Pin 24 of J601 ) PWM3L RPB11 (Pin 8 of J503 ) RPB11 (Pin 25 of J601 )