Datasheet

// 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
function of used SPI module
// // If Port Expander Library uses SPI2 module :
// Initialize SPI module used with PortExpander
// SPI2_Init_Advanced(_SPI_MASTER, _SPI_FCY_DIV2,
_SPI_CLK_HI_TRAILING);
// Pass pointer to SPI Read function of used SPI module
// SPI_Rd_Ptr = &SPI2_Read;
SPI_Glcd_Init(0); // Initialize Glcd via SPI
SPI_Glcd_Fill(0x00); // Clear Glcd
while(1) {
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();
for(counter = 5; counter < 60; counter+=5 ) { // Draw horizontal
and vertical line
Delay_ms(250);
SPI_Glcd_V_Line(2, 54, counter, 1);
SPI_Glcd_H_Line(2, 120, counter, 1);
}
Delay2s();
SPI_Glcd_Fill(0x00); // Clear Glcd
SPI_Glcd_Set_Font(Character8x7, 8, 8, 32); // Choose font, see
__Lib_GlcdFonts.c in Uses folder
SPI_Glcd_Write_Text("mikroE", 5, 7, 2); // Write string
for (counter = 1; counter <= 10; counter++) // Draw circles
SPI_Glcd_Circle(63,32, 3*counter, 1);
Delay2s();
466
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6