beautypg.com

Digilent MX3cK User Manual

Page 13

background image

Cerebot MX3cK Reference Manual

www.digilentinc.com

page 13 of 23

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

The Wire library supports a single I

2

C interface,

I2C1 on J2. This is accessed using the Wire
object.

The DTWI library supports both I

2

C interfaces.

The DTWI0 object class is used to create an
object for access to I2C1 and the DTWI1 object
class is used to access I2C2.

The pinout of the I

2

C daisy chain connector is

as follows:

Connector J2. I2C1

• J2-1 – SCL1
• J2-2 – SCL1
• J2-3 – SDA1
• J2-4 – SDA1
• J2-5 – GND
• J2-6 – GND
• J2-7 – BRD_3V3
• J2-8 – BRD_3V3

Analog Inputs


The PIC32MX320 microcontroller provides a
10-bit analog to digital (A/D) converter that
provides up to sixteen analog inputs. The
Cerebot MX3cK board provides access to 11
of them on the Pmod connectors. The
converted values produced by the A/D
converter will be in the range 0–1023.

For detailed information on the operation and
use of the A/D converter, refer to the PIC32
Family Reference Manual, Section 17, 10-bit
AD Converter.

The analog inputs are accessed using the
analogRead() function in the chipKIT MPIDE
software. The analog input pin number is
specified using the symbols A0–A10. The
digital pin numbers for the pin or the numbers
0–10 can also be used, but using the symbols
A0–A10 is recommended.

The following gives the Pmod connector
position, digital pin number, and
microcontroller I/O port and bit number for the
analog inputs:

• A0 – JC-01, digital pin 16, RB8
• A1 – JC-04, digital pin 19, RB14
• A2 – JC-07, digital pin 20, RB0
• A3 – JC-08, digital pin 21, RB1
• A4 – JD-01, digital pin 24, RB2
• A5 – JD-04, digital pin 27, RB9
• A6 – JD-07, digital pin 28, RB12
• A7 – JD-10, digital pin 31, RB13
• A8 – JE-08, digital pin 37, RB5
• A9 – JE-09, digital pin 38, RB4
• A10 – JE-10, digital pin 39, RB3

A/D Converter Reference


The PIC32 microcontroller provides two
reference inputs to the analog to digital
converter. Vref- is used set the lower reference
level and Vref+ is used to set the upper
reference level. These references can be
connected to internal references or external
references using two of the analog input pins.

When the internal references are being used,
Vref- is connected to Vss and Vref+ is
connected to Vdd. This means that the voltage
input range at the analog input pins is 0V–
3.3V. In this case, an input voltage of 0V will
convert to ~0, an input voltage of 1.65V will
convert to ~511, and an input voltage of 3.3V
will convert to ~1023.

Either one, or both, of the references can be
connected to external reference pins. When
this is done, the references can be set to
voltages other than 0V and 3.3V.

If, for example, both references were selected
to use external references, with 1V applied to
Vref- and 2V applied to Vref+, the input voltage
range at the analog input pins would be from
1V to 2V. An applied voltage of 1V would have
a converted value of ~0, 1.5V would have a
converted value of ~511, and 2V would have a
converted value of ~1023.

When both external references are being used,
Vref+ must have a higher voltage applied to in
than Vref-.