7/30/2019
Basys MX3 Reference Manual [Reference.Digilentinc]
https://reference.digilentinc.com/reference/microprocessor/basys-mx3/reference-manual?_ga=2.68739409.1349070004.1564406803-1961480359.…
25/52
TRISEbits.TRISE0 = 1; // RE0 (DB0) set as input (change 1 to 0 for output/write functionality)
TRISEbits.TRISE1 = 1; // RE1 (DB1) set as input (change 1 to 0 for output/write functionality)
TRISEbits.TRISE2 = 1; // RE2 (DB2) set as input (change 1 to 0 for output/write functionality)
ANSELEbits.ANSE20 = 0; // disable analog functionality on RE2 (DB2)
TRISEbits.TRISE3 = 1; // RE3 (DB3) set as input (change 1 to 0 for output/write functionality)
TRISEbits.TRISE4 = 1; // RE4 (DB4) set as input (change 1 to 0 for output/write functionality)
ANSELEbits.ANSE21 = 0; // disable analog functionality on RE4 (DB4)
TRISEbits.TRISE5 = 1; // RE5 (DB5) set as input (change 1 to 0 for output/write functionality)
ANSELEbits.ANSE22 = 0; // disable analog functionality on RE5 (DB5)
TRISEbits.TRISE6 = 1; // RE6 (DB6) set as input (change 1 to 0 for output/write functionality)
ANSELEbits.ANSE23 = 0; // disable analog functionality on RE6 (DB6)
TRISEbits.TRISE7 = 1; // RE7 (DB7) set as input (change 1 to 0 for output/write functionality)
ANSELEbits.ANSE27 = 0; // disable analog functionality on RE7 (DB7)
The recommended approach to controlling the LCD () module is to use the LCD () library of the Basys MX3 library pack. Features
implemented:
Low level read and write functionality are implemented using command / data pins, according to the parallel port approach described
above.
Basic commands are implemented using the low level read and write functions.
The initialization sequence is implemented according to the implemented commands.
Other functions include
Write to LCD () screen
Access the CGRAM and DDRAM memories
The Inter-Integrated Circuit (I2C) Interface provides a medium speed (100K or 400K bps) synchronous serial communications bus. The
I2C interface allows master and slave operation using either 7 bit or 10 bit device addressing. Each device is given a unique address, and the
protocol has the ability to address packets to a specific device or to broadcast packets to all devices on the bus. Refer to the Microchip
PIC32MX3XX/4XX Family Data Sheet and the PIC32 Family Reference Manual for detailed information on configuring and using the I2C
interface.
The I2C bus is an open-collector bus. Devices on the bus actively drive the signals low. The high state of the I2C signals is achieved by pull-
up resistors when no device is driving the lines low. One device on the I2C bus must provide the pull-up resistors. On the Basys MX3, I2C1
has pull-up resistors attached to it. Generally, only one device on the bus will need to have the pull-ups enabled.
The PIC32MX370F512L microcontroller provides two independent I2C interfaces. The Basys MX3 is designed to offer dedicated access to
only one of these interfaces: I2C1 (pins SCL1 and SDA1), using the daisy chain connector labeled I2C situated under the LCD (). The other
I2C interface, I2C2, is not available on the Basys MX3 board, since its pins (SCL2 and SDA2) are not wired to external connectors. Detailed
information about the operation of the I2C peripherals can be found in the PIC32 Family Reference Manual, Section 24, Inter-Integrated
Circuit.
The I2C daisy chain connector provides two positions each for connecting to the I2C signals, power and ground. By using two-wire or four-
wire MTE cables (available separately from Digilent) a daisy chain of multiple I2C-capable devices can be created.
One on-board I2C device is connected to the I2C1 interface: the accelerometer. See the Accelerometer section for more information on its
use.
Any other I2C device can be connected to the I2C labeled connector (situated under LCD () module). It should have a different I2C address
than the on-board ACL () (0x1D) chip.
8.2. Functionality
9. I2C Interface
9.1. Connectivity