Datasheet

Library Example
The following code demonstrates usage of the Lcd Library routines:
program Lcd_Test;
// Lcd module connections
var LCD_RS : sbit at PORTD.B2;
var LCD_EN : sbit at PORTD.B3;
var LCD_D4 : sbit at PORTD.B4;
var LCD_D5 : sbit at PORTD.B5;
var LCD_D6 : sbit at PORTD.B6;
var LCD_D7 : sbit at PORTD.B7;
var LCD_RS_Direction : sbit at DDRD.B2;
var LCD_EN_Direction : sbit at DDRD.B3;
var LCD_D4_Direction : sbit at DDRD.B4;
var LCD_D5_Direction : sbit at DDRD.B5;
var LCD_D6_Direction : sbit at DDRD.B6;
var LCD_D7_Direction : sbit at DDRD.B7;
// End Lcd module connections
var txt1 : array[16] of char;
txt2 : array[9] of char;
txt3 : array[8] of char;
txt4 : array[7] of char;
i : byte; // Loop variable
procedure Move_Delay(); // Function used for text moving
begin
Delay_ms(500); // You can change the moving speed here
end;
begin
txt1 := 'mikroElektronika';
txt2 := 'EasyAVR5A';
txt3 := 'Lcd4bit';
txt4 := 'example';
Lcd_Init(); // Initialize Lcd
Lcd_Cmd(LCD_CLEAR); // Clear display
Lcd_Cmd(LCD_CURSOR_OFF); // Cursor off
LCD_Out(1,6,txt3); // Write text in first row
LCD_Out(2,6,txt4); // Write text in second row
Delay_ms(2000);
Lcd_Cmd(LCD_CLEAR); // Clear display
LCD_Out(1,1,txt1); // Write text in first row
LCD_Out(2,4,txt2); // Write text in second row
Delay_ms(500);
259
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6