Hallo,
hier einmal eine einfache Ansteuerung eines I2C-Displays mit dem PCF8574.
Gruß Udo
Alles anzeigen
hier einmal eine einfache Ansteuerung eines I2C-Displays mit dem PCF8574.
Gruß Udo
BASCOM-Quellcode: Arduino-UNO-I2C-LCD.bas
- '(
- ***************************
- * *
- * Udo Lorenz *
- * 10.05.2018 *
- * *
- ***************************
- Arduino UNO Clone mit I2C-LED PCF8574
- PullUp an Scl und Sda 2,7 kOhm nicht vergessen!
- ')
- $regfile = "m328pdef.dat"
- $crystal = 16000000
- $hwstack = 80
- $swstack = 80
- $framesize = 100
- $baud = 38400
- $lib "YwRobot_Lcd_i2c.lib" 'LCD Lib
- Config Pinb.5 = Output 'Board LED
- Led Alias Portb.5
- '******************* Deklarationen ************************
- Const Pcf8574_lcd = &H4E 'Adresse des I2C-LCDs, je nach Baustein und Adresse!
- Dim Lcd_backlight As Byte '1 an, 0 aus.
- '****************** Initialisierung ***********************
- Config Scl = Portc.5 'I2C Pins
- Config Sda = Portc.4 'I2C Pins
- Config Lcd = 20 * 4 'muss nicht unbeding angegeben werden
- Config I2cdelay = 10 '100 kHz
- Waitms 300
- Lcd_backlight = 1 'Beleuchtung Einschalten
- Locate 1 , 1 'Beleuchtung Ein übermitteln
- Cls '
- '******************** Hauptprogramm ***********************
- Do
- Lcd_backlight = 1
- Locate 1 , 1
- Locate 3 , 1 : Lcd "Hello World!!!!!!!!!"
- Locate 1 , 1 : Lcd "Das ist Zeile 1-----"
- Locate 2 , 1 : Lcd "Das ist ein Test!???"
- Locate 4 , 1 : Lcd "Und hier ist Zeile 4"
- Wait 3
- Lcd_backlight = 0
- Locate 1 , 1
- Wait 1
- Loop
- End