Digilent MX7cK User Manual

Page 9

Advertising
background image

Cerebot MX7cK Reference Manual

www.digilentinc.com

page 9 of 36

Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.

Pins 0-7 are on connector JA, pins 8-15 on JB,
pins 16-23 on JC, pins 24-31 and so on. Refer
to the tables in Appendix B for detailed
information about the pin mapping between
Pmod connector, logical pin number, and
PIC32 microcontroller pin number and pin
function.

When using the Cerebot MX7cK with the
chipKIT MPIDE the functions pinMode(),
digitalRead(), and digitalWrite() are used for
digital pin I/O.

The pinMode() function is used to set the pin
direction. Pin direction can be set to: INPUT,
OUTPUT, or OPEN. OPEN is used for open-
drain and implies output.

The digitalRead() and digitalWrite() functions
are used to read or write the pins.
DigitalRead() returns the current state of the
specified pin, and digitalWrite is used to set the
state of an output pin. The pin state can be
either HIGH or LOW.

Push Buttons and LEDs


The Cerebot MX7cK board provides three
push button switches for user input and four
LEDs for output. The buttons, BTN1 and BTN2
are connected to I/O Port G, bits 6 and 7
respectively. BTN3 is connected to I/O Port A,
bit 0. To read the buttons, pins 6 and 7 of I/O
Port G and pin 0 of I/O Port A must be
configured as inputs by setting the
corresponding bits in the TRISG and TRISA
registers. The button state is then obtained by
reading the PORTG or PORTA registers.
When a button is pressed, the corresponding
bit will be high (‘1’). The pins used by the
buttons are dedicated to this use and do not
appear on any connector.

Button BTN3 is connected to the signal
TMS/RA0 on the PIC32 microcontroller. This
microcontroller pin is shared between general
purpose I/O functions and use by the JTAG
controller. The JTAG controller is enabled on
reset, and so BTN3 is not useable as a button
input until the JTAG controller is disabled. The

following statement can be used to disable the
JTAG controller:

DDPCONbits.JTAGEN = 0;

The JTAG controller is disabled by the startup
initialization code in the MPIDE runtime. It is
not necessary to disable the JTAG controller
when using the board with MPIDE.

The four LEDs are connected to bits 12-15 of
I/O Port G. LED 1 is connected to bit 12, LED 2
is connected to bit 13, and so on. These four
pins are dedicated to use with the LEDs and
do not appear on any connector pin. To use
the LEDs, configure the desired bits as outputs
by clearing the corresponding bits in the
TRISG register. The state of an LED is set by
writing values to the LATG register. Setting a
bit to 1 will illuminate the LED and setting the
bit to 0 will turn it off.

When using the MPIDE and the chipKIT
system, the buttons are accessed using
digitalRead() and the LEDs using digitalWrite().
Use the following pins to access them:

BTN1

– PIN_BTN1, pin 48, RG6

BTN2

– PIN_BTN2, pin 49, RG7

BTN3

– PIN_BTN3, pin 50, RA0

LD1

– PIN_LED1, pin 51, RG12

LD2

– PIN_LED2, pin 52, RG13

LD3

– PIN_LED3, pin 53, RG14

LD4

– PIN_LED4, pin 54, RG15

5V Signal Compatibility


The PIC32 microcontroller operates at 3.3V.
And the I/O pins provide 3.3V logic levels. It is
possible, in some circumstances, to use the
Cerebot MX7cK to operate with 5V logic
devices however.

There are two issues to consider when dealing
with 5V compatibility for 3.3V logic. The first is
protection of 3.3V inputs from damage caused
by 5V signals. The second is whether the 3.3V
output is high enough to be recognized as a
logic high value by a 5V input.

Advertising