Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
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.
program Glcd_Test;
uses bitmap;
// Glcd module connections
var GLCD_DataPort : byte at PORTC;
GLCD_DataPort_Direction : byte 
at DDRC;
//  end Glcd module connections
var GLCD_CS1 : sbit at PORTD.B2;
GLCD_CS2 : 
sbit at PORTD.B3;
GLCD_RS  : 
sbit at PORTD.B4;
GLCD_RW  : 
sbit at PORTD.B5;
GLCD_EN  : 
sbit at PORTD.B6;
GLCD_RST : 
sbit at PORTD.B7;
var GLCD_CS1_Direction : sbit at DDRD.B2;
GLCD_CS2_Direction : 
sbit at DDRD.B3;
GLCD_RS_Direction  : 
sbit at DDRD.B4;
GLCD_RW_Direction  : 
sbit at DDRD.B5;
GLCD_EN_Direction  : 
sbit at DDRD.B6;
GLCD_RST_Direction : 
sbit at DDRD.B7;
// End Glcd module connections
var counter : byte;
someText : 
array[18] of char
procedure Delay2S();                  // 2 seconds delay function
begin
Delay_ms(2000);
end;
begin
Glcd_Init();                  
// Initialize Glcd
Glcd_Fill(0x00);            
// Clear Glcd
while TRUE do
begin
Glcd_Image(@truck_bmp);     
// Draw image
Delay2S(); delay2S();
Glcd_Fill(0x00);                      // Clear Glcd
246
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6