Mikroelektronika MIKROE-742 데이터 시트
SPI_Glcd_Init
402
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
procedure SPI_Glcd_Init(DeviceAddress : byte);
Returns
Nothing.
Description
Initializes the Glcd 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
var SPExpanderCS : sbit at PORTB.B1;
var SPExpanderCS : sbit at PORTB.B1;
SPExpanderRST :
sbit at PORTB.B0;
SPExpanderCS_Direction :
sbit at DDRB.B1;
SPExpanderRST_Direction :
sbit at DDRB.B0;
...
// If Port Expander Library uses SPI1 module :
SPI1_Init_Advanced(_SPI_MASTER, _SPI_FCY_DIV2, _SPI_CLK_HI_TRAIL-
SPI1_Init_Advanced(_SPI_MASTER, _SPI_FCY_DIV2, _SPI_CLK_HI_TRAIL-
ING); // Initialize SPI module used with PortExpander
SPI_Rd_Ptr := @SPI1_Read; // Pass pointer to SPI
Read function of used SPI module
Read function of used SPI module
SPI_Glcd_Init(0);