program MyProject1
dim LCD_RS as sbit at RB4_bit 'pin tanımlarını kendi devrenize göre değiştirin
LCD_EN as sbit at RB5_bit
LCD_D4 as sbit at RB0_bit
LCD_D5 as sbit at RB1_bit
LCD_D6 as sbit at RB2_bit
LCD_D7 as sbit at RB3_bit
LCD_RS_Direction as sbit at TRISB4_bit
LCD_EN_Direction as sbit at TRISB5_bit
LCD_D4_Direction as sbit at TRISB0_bit
LCD_D5_Direction as sbit at TRISB1_bit
LCD_D6_Direction as sbit at TRISB2_bit
LCD_D7_Direction as sbit at TRISB3_bit
dim txt1 as char[16]
txt2 as char[9]
txt3 as char[8]
txt4 as char[7]
dim i as byte
sub procedure Move_Delay()
Delay_ms(500)
end sub
main:
TRISB = 0
PORTB = 0xFF
TRISB = 0xFF
ANSEL = 0
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 ' Move text to the right 4 times
Lcd_Cmd(_LCD_SHIFT_RIGHT)
Move_Delay()
next i
while TRUE ' Endless loop
for i=0 to 7 ' Move text to the left 8 times
Lcd_Cmd(_LCD_SHIFT_LEFT)
Move_Delay()
next i
for i=0 to 7 ' Move text to the right 8 times
Lcd_Cmd(_LCD_SHIFT_RIGHT)
Move_Delay()
next i
wend
end.