15 output compare, 16 input capture – Digilent 410-295P-KIT User Manual

Page 22

Advertising
background image

ChipKIT Pro MX4 Reference Manual

Copyright Digilent, Inc. All rights reserved.

Other product and company names mentioned may be trademarks of their respective owners.

Page 22 of 37

• TCK4 – JE-10, digital pin 39, RC03
• TCK5 – JK-10, digital pin 71, RC04


For detailed information on the operation of the PIC32 timers, refer to the PIC32 Family Reference Manual, Section
14, Timers.

When using the MPIDE software, the symbols PIN_TCK2, PIN_TCK3, PIN_TCK4, and PIN_TCK5 can be used to access
the timer input pins.

Control and operation of the timers is not explicitly provided in the current version of the MPIDE software. This
capability will be added in a future version of the software. Timers are used implicitly by various core functions and
libraries, however.

15 Output Compare

The PIC32 microcontroller provides five output compare units that can be used to control the timing of state
changes on certain output pins or to generate pulse width modulated (PWM) outputs.

Each output compare unit works with a particular output pin (OC1-OC5). They can be programmed to control the
pin in any of the following ways:

• PWM output
• Generate continuous pulses
• Generate a single pulse
• Toggle the output pin
• Generate falling edge
• Generate rising edge


The output compare units work in conjunction with a timer. Either Timer2 or Timer3 can be used with any of the
five output compare units.

Refer to the PIC32 Family Reference Manual, Section 16, Output Compare for detailed information on the use of
the output compares units.

When using the MPIDE software, these are accessed using the analogWrite() function. The digital pin number, or
preferably, the symbols PIN_OC1 through PIN_OC5 are used to specify the pin. The MPIDE software currently only
supports using the output compare units to generate PWM outputs. It uses Timer2 to control the output
compares.

The following gives Pmod connector position, chipKIT pin number, and microcontroller I/O port and bit number for
the output compare unit’s output pins:

• OC1 – JH-08, digital pin 53, RD0
• OC2 – JD-02, digital pin 25, RD1
• OC3 – JD-08, digital pin 29, RD2
• OC4 – JE-08, digital pin 37, RD3
• OC5 – JB-09, digital pin 14, RD4

16 Input Capture

Advertising