User manual

mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
541
SPI_Lcd8_Cong
Prototype
sub procedure SPI_Lcd8_Cong(dim DeviceAddress as byte)
Description Initializes the Lcd module via SPI interface.
Parameters - DeviceAddress: SPI expander hardware address, see schematic at the bottom of this page
Returns Nothing.
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 dened before using this function.
The SPI module needs to be initialized. See SPIx_Init and SPIx_Init_Advanced routines.
Example
‘ Port Expander module connections
dim SPExpanderRST as sbit at LATF0_bit
SPExpanderCS as sbit at LATF1_bit
SPExpanderRST_Direction as sbit at TRISF0_bit
SPExpanderCS_Direction as sbit at TRISF1_bit
‘ End Port Expander module connections
...
SPI1_Init() ‘ Initialize SPI interface
SPI_Lcd8_Cong(0) ‘ Intialize Lcd in 8bit mode via spi
Notes None.
SPI_Lcd8_Out
Prototype
sub procedure SPI_Lcd8_Out(dim row, column as byte, dim byref text as
string)
Description Prints text on Lcd starting from specied position. Both string variables and literals can be passed as
a text.
Parameters - row: starting position row number
- column: starting position column number
- text: text to be written
Returns Nothing.
Requires Lcd needs to be initialized for SPI communication, see SPI_Lcd8_Cong routine.
Example
‘ Write text “Hello!” on Lcd starting from row 1, column 3:
SPI_Lcd8_Out(1, 3, “Hello!”)
Notes None.