Datasheet

main:
' If Port Expander Library uses SPI1 module
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 sub function of used SPI module
' ' If Port Expander Library uses SPI2 module
' SPI2_Init_Advanced(_SPI_MASTER, _SPI_FCY_DIV2,
_SPI_CLK_HI_TRAILING) ' Initialize SPI module used with PortExpander
' Spi_Rd_Ptr = &SPI2_Read ' Pass pointer to
SPI Read sub function of used SPI module
SPI_Glcd_Init(0) ' Initialize Glcd
via SPI
SPI_Glcd_Fill(0x00) ' Clear Glcd
while TRUE
SPI_Glcd_Image(@truck_bmp) ' Draw image
Delay2s() Delay2s()
SPI_Glcd_Fill(0x00) ' Clear Glcd
Delay2s
SPI_Glcd_Box(62,40,124,56,1) ' Draw box
SPI_Glcd_Rectangle(5,5,84,35,1) ' Draw rectangle
SPI_Glcd_Line(0, 63, 127, 0,1) ' Draw line
Delay2s()
counter = 5
while (counter < 60) ' Draw horizontal
and vertical line
Delay_ms(250)
SPI_Glcd_V_Line(2, 54, counter, 1)
SPI_Glcd_H_Line(2, 120, counter, 1)
counter = counter + 5
wend
Delay2s()
SPI_Glcd_Fill(0x00) ' Clear Glcd
SPI_Glcd_Set_Font(@Character8x7, 8, 8, 32) ' Choose font
"Character8x7"
SPI_Glcd_Write_Text("mikroE", 5, 7, 2) ' Write string
for counter = 1 to 10 ' Draw circles
SPI_Glcd_Circle(63,32, 3*counter, 1)
next counter
Delay2s()
SPI_Glcd_Box(12,20, 70,63, 2) ' Draw box
Delay2s()
403
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6