Mikroelektronika MIKROE-350 Datenbogen
Library Example
The following example demonstrates routines of the Glcd library: initialization,
clear(pattern fill), image displaying, drawing lines, circles, boxes and rectangles, text
displaying and handling.
clear(pattern fill), image displaying, drawing lines, circles, boxes and rectangles, text
displaying and handling.
program Glcd_Test
include bitmap
' Glcd module connections
dim GLCD_DataPort as byte at PORTC
dim GLCD_DataPort as byte at PORTC
GLCD_DataPort_Direction
as byte at DDRC
dim GLCD_CS1 as sbit at PORTD.B2
GLCD_CS2
as sbit at PORTD.B3
GLCD_RS
as sbit at PORTD.B4
GLCD_RW
as sbit at PORTD.B5
GLCD_EN
as sbit at PORTD.B6
GLCD_RST
as sbit at PORTD.B7
dim GLCD_CS1_Direction as sbit at DDRD.B2
GLCD_CS2_Direction
as sbit at DDRD.B3
GLCD_RS_Direction
as sbit at DDRD.B4
GLCD_RW_Direction
as sbit at DDRD.B5
GLCD_EN_Direction
as sbit at DDRD.B6
GLCD_RST_Direction
as sbit at DDRD.B7
' End Glcd module connections
dim counter as byte
someText
as char[18]
sub procedure Delay2S() ' 2 seconds delay sub
function
function
Delay_ms(2000)
end sub
main:
Glcd_Init() ' Initialize Glcd
Glcd_Fill(0x00) ' Clear Glcd
Glcd_Fill(0x00) ' Clear Glcd
while TRUE
Glcd_Image(@truck_bmp) ' Draw image
Delay2S() delay2S()
Glcd_Fill(0x00) ' Clear Glcd
Glcd_Box(62,40,124,63,1) ' Draw box
Glcd_Rectangle(5,5,84,35,1) ' Draw rectangle
Glcd_Line(0, 0, 127, 63, 1) ' Draw line
Glcd_Rectangle(5,5,84,35,1) ' Draw rectangle
Glcd_Line(0, 0, 127, 63, 1) ' Draw line
Delay2S()
counter = 5
231
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6