User manual

Basys MX3™ Board Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 26 of 56
The command pins (DISP_RS, DISP_RW and DISP_EN) must be defined as digital output with analog functionality
disabled for DISP_RS:
TRISBbits.TRISB15 = 0; // RB15 (DISP_RS) set as an output
ANSELBbits.ANSB15 = 0; // disable analog functionality on RB15
(DISP_RS)
TRISDbits.TRISD5 = 0; // RD5 (DISP_RW) set as an output
TRISDbits.TRISD4 = 0; // RD4 (DISP_EN) set as an output
The data pins (DB0 DB7) must be set as digital pins, with the direction according to the type of operation (read /
write). The analog functionality should also be disabled for DB2, DB4, DB5, DB6, and DB7.
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)
8.2 Functionality
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.