'************************************************************************ 'Compiler : BASCOM-AVR (Vers. 2.0.7.7) 'Hardware : Versuchsplatine LCD 8x2 (Holz) u. Modul von Pollin 'Chip type : ATMega48V (14%) 'Programm : I2C_LCD_2 > Zeichen an LCD '************************************************************************ $regfile = "m48def.dat" $crystal = 4000000 'Quarz (111101) DivideClock = disabled $lib "Pollin_Lcd_i2c.lib" '*********************Config I2C*************************** Config SDA = PortD.2 'PortD.2 = serial data (SDA) gelb Config SCL = PortD.3 'PortD.3 = serial data (SCL) grün I2Cinit 'Ini the I2C SCL and SDA pins '******************* Deklarationen ************************ Const Pcf8574_lcd = &H40 'Adresse des I2C-LCDs Dim Lcd_backlight As Byte '1 = an; 0 = aus. Wird erst nach einen 'LCD-Befehl umgesetzt! Dim I As Byte Dim _lcd_e As Byte _lcd_e = 64 'LCD im 4-Bit Mode betreiben '****************** Initialisierung *********************** Config Lcd = 16 * 2 'nicht unbedingt nötig Config I2cdelay = 1 Waitms 300 'warte bis LCD-Initialisiert ist! '******************** Hauptprogramm *********************** Cls Lcd " Hallo Dresden! " Wait 1 Lcd_backlight = 0 Locate 2 , 1 Lcd "-- 16 Zeichen --" Wait 2 Lcd_backlight = 1 Locate 1 , 1 'Backlight-Zustand an LCD übermitteln Do 'Sinnlose Schleife! nop Loop End