Hallo Robert,
es läuft!!!!
Code:
copyright = Guenter Gerold
www = www.gerold-online.de/cms
email = tv@gerold-online.de
comment = I2C LCD Treiber
libversion = 1.00
date = 07.07.2008
statement = Wer was zu verbessern hat kann sich bei mir melden...
statement =
history = Final.
[_Init_LCD]
_Init_LCD:
*BASIC: waitms 20
*BASIC: i2cstart
*BASIC: i2cwbyte gg_Displayport
*BASIC: i2cwbyte &H06
*BASIC: i2cwbyte &H00
*BASIC: i2cwbyte &HE8
*BASIC: i2cstop
Ldi _temp2, &H3c
rCall _gg_i2c_config
Ldi _temp2, &H0f
rCall _gg_i2c_config
_gg_i2c_config:
*BASIC: I2cstart
*BASIC: I2cwbyte gg_Displayport
*BASIC: I2cwbyte &H02
*BASIC: I2cwbyte _temp2
*BASIC: I2cwbyte &H01
*BASIC: I2cstop
*BASIC: Waitms 2
*BASIC: I2cstart
*BASIC: I2cwbyte gg_Displayport
*BASIC: I2cwbyte &H03
*BASIC: I2cwbyte &H00
*BASIC: I2cstop
ret
[end]
[_CLS]
_CLS:
*BASIC: I2cstart
*BASIC: I2cwbyte gg_Displayport
*BASIC: I2cwbyte &H02
*BASIC: I2cwbyte &H01
*BASIC: I2cwbyte &H01
*BASIC: I2cstop
*BASIC: Waitms 2
*BASIC: I2cstart
*BASIC: I2cwbyte gg_Displayport
*BASIC: I2cwbyte &H03
*BASIC: I2cwbyte &H00
*BASIC: I2cstop
[end]
[_Write_lcd]
_Write_lcd:
Ldi _temp2, &H05
rjmp _Write_lcd_Byte
_Lcd_control:
Ldi _temp2, &H01
_Write_lcd_Byte:
*BASIC: I2cstart
*BASIC: I2cwbyte gg_Displayport
*BASIC: I2cwbyte &H02
*BASIC: I2cwbyte _temp1
*BASIC: I2cwbyte _temp2
*BASIC: I2cstop
rcall LCD_Write_Enable
ret
LCD_Write_Enable:
*BASIC: I2cstart
*BASIC: I2cwbyte gg_Displayport
*BASIC: I2cwbyte &H03
*BASIC: I2cwbyte &H04
*BASIC: I2cstop
ret
[end]
Folgender Code ruft auf:
Code:
'###############################################################################
'# #
'# I2C-Display mit PCA 9555D #
'# #
'# (c) Günter Gerold #
'# #
'# Zum Pin sparen kann ein LCD-Display auch an einen I2C-Bus gehängt werden #
'# Die eingebauten Bascom-Befehle können genutzt werden #
'# #
'###############################################################################
$regfile = "m8def.dat"
$crystal = 8000000
$lib "gg.lib"
Dim A As Byte
Config Scl = Portc.5 'Configure I2C SCL
Config Sda = Portc.4
Const Gg_displayport = &H40 'Addresse des ICs
Config Lcdbus = 8
Config Lcd = 16 * 1a
Do
Cls
Lcd "123"
Cursor Off
Waitms 2000
Cursor On
Waitms 1000
Cursor Blink
Waitms 1000
Lowerline
Lcd "456"
Waitms 1000
Display Off
Waitms 1000
Display On
Cls
Lcd "Shift"
Waitms 1000
For A = 1 To 8
Shiftlcd Right
Waitms 500
Next
For A = 1 To 8
Shiftlcd Left
Waitms 200
Next
Waitms 1000
Loop
Lesezeichen