Just added a new capability to the LCD library. LCD connectivity for SPI Serial Expander like the MCP23S17. Connectivity is simple using only three microcontroller ports ( you could use two and strap the SPI Chip Select [ LCD_SPI_CS] to ground).
It is fast and just works.
Configuration is amazing easy. As is all the LCD connectivity. As follows:
//Constants - LCD connectivity type;controls whether to use HW SPI; The inter character delay#defineLCD_IO14#defineLCD_HARDWARESPI'PinmappingsforLCDIOSPIExpander#defineLCD_SPI_DOportc.5#defineLCD_SPI_SCKportc.3#defineLCD_SPI_CSporta.2
If you are using a PPS chip and you want to use the hardware SPI then you need to add PPS, something like this but this is specific to one type of chip and is shown as an example. I have added an IFDEF test to automatically support the use of software SPI.
The connectivity is shown below: The microcontroller connections are as follows:
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)
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#defineLCD_IO14#defineLCD_HARDWARESPI#defineLCD_SPEEDFAST#defineHWSPIMODEMASTERFAST//These are phyiscal connections from the expander to the LCD. These are automatically set in the library and are shown here purely for clarity.#defineLCD_SPI_EXPD_ADDRESS0x40// address of the expander#defineLCD_SPI_EXPANDER_E_ADDRESS0x40// GPA6 on the expander#defineLCD_SPI_EXPANDER_RS_ADDRESS0x80// GPA7 on the expander 'PinmappingsforLCDIOSPIExpander#defineLCD_SPI_DOportc.5#defineLCD_SPI_SCKportc.3#defineLCD_SPI_CSporta.2// Optional(s) reset Port.Pin connection to expander, select one.// #define LCD_SPI_RESET_IN portb.5#defineLCD_SPI_RESET_OUTportb.5
LCD connectivity for SPI Serial Expander
Just added a new capability to the LCD library. LCD connectivity for SPI Serial Expander like the MCP23S17. Connectivity is simple using only three microcontroller ports ( you could use two and strap the SPI Chip Select [ LCD_SPI_CS] to ground).
It is fast and just works.
Configuration is amazing easy. As is all the LCD connectivity. As follows:
If you are using a PPS chip and you want to use the hardware SPI then you need to add PPS, something like this but this is specific to one type of chip and is shown as an example. I have added an IFDEF test to automatically support the use of software SPI.
The connectivity is shown below: The microcontroller connections are as follows:
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)
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.
Anyway, enjoy.
Last edit: Anobium 2023-08-17
See https://gcbasic.sourceforge.io/help/_lcd_io_14.html for the Help on the new capability.