program Lcd_Test; //LCD module connections var LCD_RS : sbit at RD0_bit; var LCD_EN : sbit at RD1_bit; var LCD_D4 : sbit at RD4_bit; var LCD_D5 : sbit at RD5_bit; var LCD_D6 : sbit at RD6_bit; var LCD_D7 : sbit at RD7_bit; var LCD_RS_Direction : sbit at TRISD0_bit; var LCD_EN_Direction : sbit at TRISD1_bit; var LCD_D4_Direction : sbit at TRISD4_bit; var LCD_D5_Direction : sbit at TRISD5_bit; var LCD_D6_Direction : sbit at TRISD6_bit; var LCD_D7_Direction : sbit at TRISD7_bit; // connect R/W to ground // 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 TRISD := 0; PORTD := 0xFF; TRISD := 0xFF; //ANSEL := 0; // Configure AN pins as digital I/O //ANSELH := 0; txt1 := 'mikroElektronika'; txt2 := 'EasyPIC6'; 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,5,txt2); // Write text in second row Delay_ms(500); // Moving text for i:=0 to 3 do // Move text to the right 4 times begin Lcd_Cmd(_LCD_SHIFT_RIGHT); Move_Delay(); end; while TRUE do // Endless loop begin for i:=0 to 7 do // Move text to the left 8 times begin Lcd_Cmd(_LCD_SHIFT_LEFT); Move_Delay(); end; for i:=0 to 7 do // Move text to the right 8 times begin Lcd_Cmd(_LCD_SHIFT_RIGHT); Move_Delay(); end; end; end.