Push Buttons And Leds - Digilent chipKIT Pro MX7 Reference Manual

Table of Contents

Advertisement

chipKIT™ Pro MX7 Board Reference Manual
The MPIDE system uses logical pin numbers to identify digital I/O pins on the connectors. These pin numbers start
with pin 0 and are numbered up consecutively.
On the chipKIT Pro MX7, pin numbers 0-47 are used to access the pins on the Pmod ports and pin numbers 55-58
are used for the signal pins on the I
1 (JA-01) is digital pin 0, JA pin 2 (JA-02) is digital pin 1, and so on.
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 port, logical pin number, and PIC32
microcontroller pin number and pin function.
When using the chipKIT Pro MX7 with the 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.
4.1

Push Buttons and LEDs

The chipKIT Pro MX7 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
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
2
C connectors, J7 and J8. The pin numbers are assigned so that connector JA pin
Page 9 of 35

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the chipKIT Pro MX7 and is the answer not in the manual?

Questions and answers

Table of Contents