Richard,
This code is written in Mikro Basic I think and works...I was trying to convert it to PicBasic..
Below it I have pasted the Config file that goes with it..
' *
' * Project name:
' Lcd_Test (Demonstration of the LCD library routines)
' * Copyright:
' (c) Mikroelektronika, 2011.
' * Revision History:
' 20110929:
' - initial release (FJ);
' * Description:
' This code demonstrates how to use LCD 4-bit library. LCD is first
' initialized, then some text is written, then the text is moved.
' * Test configuration:
' MCU: PIC18F45K22
' http://ww1.microchip.com/downloads/e...Doc/41412D.pdf
' Dev.Board: EasyPIC7 - ac:LCD
' http://www.mikroe.com/easypic/
' Oscillator: HS-PLL 32.0000 MHz, 8.0000 MHz Crystal
' Ext. Modules: Character Lcd 2x16
' http://www.mikroe.com/store/components/various/
' SW: mikroBasic PRO for PIC
' http://www.mikroe.com/mikrobasic/pic/
' * NOTES:
' - Turn on Lcd backlight switch SW4.6. (board specific)
' *
program Lcd
' Lcd module connections
dim LCD_RS as sbit at LATB4_bit
LCD_EN as sbit at LATB5_bit
LCD_D4 as sbit at LATB0_bit
LCD_D5 as sbit at LATB1_bit
LCD_D6 as sbit at LATB2_bit
LCD_D7 as sbit at LATB3_bit
dim 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
' End Lcd module connections
dim txt1 as char[16]
txt2 as char[9]
txt3 as char[8]
txt4 as char[7]
i as byte ' Loop variable
sub procedure Move_Delay() ' Function used for text moving
Delay_ms(500) ' You can change the moving speed here
end sub
main:
ANSELB = 0 ' Configure PORTB pins as digital
txt1 = "mikroElektronika"
txt2 = "EasyPIC7"
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 display4
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.
The config file...
<?xml version="1.0"?>
<MCU_DEVICE_FLAGS>
<DEVICE>
<DEVICE_NAME>P18F45K22</DEVICE_NAME>
<VALUE>
<COUNT>11</COUNT>
<VALUE0>
<VAL>$300001:$0033</VAL>
</VALUE0>
<VALUE1>
<VAL>$300002:$001F</VAL>
</VALUE1>
<VALUE2>
<VAL>$300003:$003C</VAL>
</VALUE2>
<VALUE3>
<VAL>$300005:$00BD</VAL>
</VALUE3>
<VALUE4>
<VAL>$300006:$0081</VAL>
</VALUE4>
<VALUE5>
<VAL>$300008:$000F</VAL>
</VALUE5>
<VALUE6>
<VAL>$300009:$00C0</VAL>
</VALUE6>
<VALUE7>
<VAL>$30000A:$000F</VAL>
</VALUE7>
<VALUE8>
<VAL>$30000B:$00E0</VAL>
</VALUE8>
<VALUE9>
<VAL>$30000C:$000F</VAL>
</VALUE9>
<VALUE10>
<VAL>$30000D:$0040</VAL>
</VALUE10>
</VALUE>
</DEVICE>
</MCU_DEVICE_FLAGS>
Bookmarks