Mikroelektronika MIKROE-350 Fiche De Données

Page de 526
SPI_Glcd_Image
Library Example
The example demonstrates how to communicate to KS0108 Glcd via the SPI module, using seri-
al to parallel convertor MCP23S17.
program SPI_Glcd
include bitmap
' Port Expander module connections
dim SPExpanderRST as sbit at PORTB.0
SPExpanderCS  
as sbit at PORTB.1
SPExpanderRST_Direction 
as sbit at DDRB.0
SPExpanderCS_Direction  
as sbit at DDRB.1
' End Port Expander module connections
dim someText as char[20]
counter 
as byte
sub procedure Delay2S
delay_ms(2000)
end sub
402
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure SPI_Glcd_Image(dim const image as ^byte)
Returns
Nothing.
Description
Displays bitmap on Glcd.
Parameters : 
image:
image to be displayed. Bitmap array can be located in both code and  
RAM memory (due to the mikroBasic PRO for AVR pointer to const and 
pointer to RAM equivalency). 
Use the mikroBasic PRO’s integrated Glcd Bitmap Editor (menu option Tools ›
Glcd Bitmap Editor
) to convert image to a constant array suitable for display-
ing on Glcd.
Requires
Glcd needs to be initialized for SPI communication, see SPI_Glcd_Init routines.
Example
' Draw image my_image on Glcd
SPI_Glcd_Image(my_image)