1.1 ACC PWM Generation
This example uses ACC peripheral Library to generate a PWM waveform with variable duty cycle.
Description
This application example uses Analog Comparator to generate a PWM waveform by comparing the sine wave generated from the DAC with an external input voltage. Duty cycle of the PWM waveform is inversely proportional to the input voltage.
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/acc/acc_wav_gen/firmware.
To build the application, refer to the following table and open the project using its IDE.
Project Name | Description |
---|---|
pic32cz_ca70_curiosity_ultra.X | MPLABX project for PIC32CZ CA70 Curiosity Ultra Development Kit |
Setting Up the Hardware
The following table shows the target hardware for the application projects.
Project Name | Description |
---|---|
pic32cz_ca70_curiosity_ultra.X | PIC32CZ CA70 Curiosity Ultra Development Kit |
Setting Up PIC32CZ CA70 Ultra Curiosity Development Kit
- Comparator Positive Input: Connect an external voltage source to PD30 (Pin 3 of the EXT2 Connector)
- Comparator Negative Input: Sine wave from the DAC Channel 0. No connection required
- 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 respective IDE
- Observe the generated PWM waveform on the output pin using an oscilloscope
- Change the positive input of the comparator from 0 to 3.3V and observe the duty cycle of the PWM waveform changing from 0 to 100 percentage
Board | PWM Output Pin |
---|---|
PIC32CZ CA70 Curiosity Ultra Development Kit | PC17 (Pin 10 of the EXT1 Connector) |