Here is a short program that when the "Home" is removed puts random text on LCD
Regards Paul
[code:1:3b8562a2d8]
$regfile = "m328pdef.dat"
$crystal = 16000000
$baud = 57600
$hwstack = 100 ' default use 32 for the hardware stack
$swstack = 100 'default use 10 for the SW stack
$framesize = 100 'default use 40 for the frame space
Config I2cdelay = 40
$lib "i2c_twi.lib" 'hardware i2c/TWI
Config Twi = 100000
$lib "bl_Lcd_i2c.lib" ' AN #118 library from Kent
Backlight_on Alias &H08
Backlight_off Alias &H00
Const Pcf_d4 = 4
Const Pcf_d5 = 5
Const Pcf_d6 = 6
Const Pcf_d7 = 7
Const Pcf_rs = 0
Const Pcf_rw = 1
Const Pcf_e1 = 2
Dim B As Byte
Dim A As Byte
Dim _lcd_e As Byte
Dim Backlight As Byte
_lcd_e = 128
Const Pcf8574_lcd = &H4E 'Defines the address of the I/O expander for LCD
Config Scl = Portc.5 'we need to provide the SCL pin name
Config Sda = Portc.4
'=======================================
'without this you get rubbish on LCD at power up
Home
'=======================================
Locate 1 , 1
Lcd "Test Line 1"
Locate 2 , 1
Lcd "Test Line 2"
End
[/code:1:3b8562a2d8]
↧