Jump to main content

##

# 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 Name | Description
--- | ---
pic32ak_gc_curiosity.X | MPLABX project for Curiosity Platform Development Board and PIC32AK1216GC41064 General Purpose Dual In-Line Module (DIM)

## Setting up the hardware

The following table shows the target hardware for the application projects.

Project Name | Description
--- | ---
pic32ak_gc_curiosity.X | Curiosity Platform Development Board and PIC32AK1216GC41064 General Purpose Dual In-Line Module (DIM)

### Setting up Curiosity Development Board

- Insert the GP DIM on to DIM slot of Curiosity Board
- Connect the PKoB (J24) on the board to the computer using a USB type-C cable

## Running the Application

1. Build and program the application project using its IDE
2. Observe generated waveforms on the oscilloscope

OC Pin | Port Pin | Observable characteristic of the waveform
--- | --- | ---
OCM1 | Pin 3 of XPRO1 Header | Dual Edge output with 5 kHz frequency
OCM4 | Pin 8 of XPRO1 Header | Active high output
OCM2 | Pin 4 of XPRO1 Header | Toggle output with 2.5 kHz frequency