Mikroelektronika MIKROE-350 Fiche De Données
SPI_Lcd8_Config
414
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure SPI_Lcd8_Config(dim DeviceAddress as byte)
Returns
Nothing.
Description
Initializes the Lcd module via SPI interface.
Parameters :
-
DeviceAddress:
spi expander hardware address, see schematic at the
bottom of this page
Requires
Global variables :
-
SPExpanderCS:
Chip Select line
-
SPExpanderRST:
Reset line
-
SPExpanderCS_Direction:
Direction of the Chip Select pin
-
SPExpanderRST_Direction:
Direction of the Reset pin
must be defined before using this function.
SPI module needs to be initialized. See SPI1_Init and SPI1_Init_Advanced routines.
Example
' port expander pinout definition
dim SPExpanderCS as sbit at PORTB.B1
dim SPExpanderCS as sbit at PORTB.B1
SPExpanderRST
as sbit at PORTB.B0
SPExpanderCS_Direction
as sbit at DDRB.B1
SPExpanderRST_Direction
as sbit at DDRB.B0
...
Spi1_Init() ' Initialize spi
interface
Spi_Rd_Ptr = @SPI1_Read ' Pass pointer to
SPI Read function of used SPI module
Spi1_Init() ' Initialize spi
interface
Spi_Rd_Ptr = @SPI1_Read ' Pass pointer to
SPI Read function of used SPI module
SPI_Lcd8_Config(0) ' Intialize lcd in
8bit mode via spi
8bit mode via spi