![Digilent Cerebot MX7cK REV B Скачать руководство пользователя страница 20](http://html1.mh-extra.com/html/digilent/cerebot-mx7ck-rev-b/cerebot-mx7ck-rev-b_reference-manual_2497465020.webp)
Cerebot MX7cK Reference Manual
www.digilentinc.com
page 20 of 34
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.
Timers are used implicitly by various core
functions and libraries, however.
Output Compare
The PIC32MX795 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). It 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 chipKIT 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 chipKIT 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 – JD-02, digital pin 25, RD00
•
OC2 – JD-07, digital pin 28, RD01
•
OC3 – JD-08, digital pin 29, RD02
•
OC4 – JD-09, digital pin 30, RD03
•
OC5 – JC-09, digital pin 22, RD04
Input Capture
The PIC32MX795 microcontroller provides five
input capture units. The design of the Cerebot
MX7cK board allows the use of three of them.
An input capture unit works in conjunction with
a timer and monitors the state of an associated
pin. When the pin changes state, the current
value of the timer is captured. The input
capture units can be used with either Timer2 or
Timer3.
The input capture unit can be programmed to
be sensitive to either a rising edge, a falling
edge, or both edges on the input pin. An
interrupt can also be signaled when an input
capture is triggered. Each input capture has a
four level deep FIFO that can buffer up to four
capture events.
For detailed information on the operation and
use of the input capture units, refer to the
PIC32 Family Reference Manual, Section 15,
Input Capture.
The following gives the Pmod connector
position, chipKIT pin number, and
microcontroller port and bit number for the
input capture units input pins:
•
IC1 – not available
•
IC2 – JD-01, digital pin 24, RD09
•
IC3 – JD-04, digital pin 27, RD10
•
IC4 – not available
•
IC5 – JD-10, digital pin 31, RD12
When using the chipKIT MPIDE software, the
symbols PIN_IC2, PIN_IC3, and PIN_IC5 can
be used to access the capture input pins.
Use of the input capture units is not currently
supported in the chipKIT MPIDE software. This
will be added in a future version.