Using connection mode 14:
Using this LCD IO methof the LCD is controlled via an SPI expander.
To use mode 14 you must define the SPI ports as normal in your GCB code. Then, define the LCD type, set the SPI address of the SPI expander, and, the LCD speed, if required.
Relevant Constants:
These constants are used to control settings for the LCD routines included with GCBASIC. To set them, place a line in the
main program file that uses #define
to assign a value to the particular constant.
When using this mode only three constants are mandated - all others can be ignored.
Constant Name | Controls | Value |
---|---|---|
|
I/O mode |
|
|
Microcontroller SPI data out port |
Required |
|
Microcontroller SPI clock out port |
Required |
|
Microcontroller SPI chip select port |
Required |
Connectivity
The connectivity is shown below. The microcontroller connections are as shown below. This is an example using the Microchip Explorer 8 board.
RC3 > Expander SPI SCK ( clock) RC5 > Expander SPI SI (slave in) RA2 > Expander SPI CS ( chip select) - could be set to 0v0 RB5 > Expander Reset ( optional)
Optional configuration
There are some options you can tweak. See the example setup below. You can play with the use of hardware or software SPI, SPI frequency ( HWSPIMODE MASTERFAST). LED speed, the connectivity between the expander and the LCD and otheroptions.
//Constants - LCD connectivity type; controls whether to use HW SPI; The inter character delay #define LCD_IO 14 #define LCD_HARDWARESPI #define LCD_SPEED FAST #define HWSPIMODE MASTERFAST //These are the phyiscal connections from the expander to the LCD. These are automatically set in the library and are shown here purely for clarity. #define LCD_SPI_EXPD_ADDRESS 0x40 // address of the expander #define LCD_SPI_EXPANDER_E_ADDRESS 0x40 // GPA6 on the expander #define LCD_SPI_EXPANDER_RS_ADDRESS 0x80 // GPA7 on the expander //Pin mappings for LCD IO SPI Expander #define LCD_SPI_DO portc.5 // constant is mandated #define LCD_SPI_SCK portc.3 // constant is mandated #define LCD_SPI_CS porta.2 // constant is required. // Optional(s) reset Port.Pin connection to expander, select one. // #define LCD_SPI_RESET_IN portb.5 #define LCD_SPI_RESET_OUT portb.5
For code examples see LCD Solutions.
See the separate sections of the Help file for the specifics of each Connection Mode.
For more help, see LCD_IO 0, LCD_IO 1, LCD_IO 2 LCD_IO 2_74xx164, LCD_IO 2_74xx174, LCD_IO 4, LCD_IO 8, LCD_IO 10, LCD_IO 12