1.4 CCP Compare Mode

This example shows how to use the CCP module in compare mode to generate an dual edge, active high, and toggle output on compare match.

Description

Three TC channels are configured in compare mode. Each channel generates different output waveform depending upon configured action on compare match and period match.

  • Dual Edge output: Output is set high on compare A match and is set low on compare B match.
  • Active high output: Output is set high on compare A match and remains high.
  • Toggle output: Output toggles on compare A match.

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.

Path of the application within the repository is apps/ccp/ccp_compare_mode.

To build the application, refer to the following table and open the project using its IDE.

Project NameDescription
pic32ak_gc_curiosity.XMPLABX project for Curiosity Platform Development Board and PIC32AK1216GC41064 General Purpose Dual In-Line Module (DIM)

Running the Application

  1. Build and program the application project using its IDE
  2. Observe generated waveforms on the oscilloscope
OC PinPort PinObservable characteristic of the waveform
OCM1Pin 3 of XPRO1 HeaderDual Edge output with 5 kHz frequency
OCM4Pin 8 of XPRO1 HeaderActive high output
OCM2Pin 4 of XPRO1 HeaderToggle output with 2.5 kHz frequency