Hallo,
ich habe mir eine Platine von Pollin(810145) besorgt auf der ein PCF8574 ist, den ich über I²C ansteuern möchte. Nun hab ich den standard Code von Bascom genommen um das LCD anzusteuern.
Wenn ich ein LCD mit 2*16 Zeichen nehme funktioniert der Code.
Wenn ich ein LCD mit 4*20 Zeichen nutze sehe ich nur Balken.
Gibt es da noch etwas zu beachten?
Code:$regfile = "m644def.dat" 'AT-Mega664 $crystal = 14745600 'Quarz: 14,7456 MHz - Quarz auf Platine $baud = 9600 'RS232 Baudrate definieren $hwstack = 250 $swstack = 250 $framesize = 450 $lib "Lcd_i2c.lib" 'My I2C driver for the LCD Config I2cdelay = 1 Const Pcf8574_lcd = &H40 'Defines the address of the I/O expander for LCD Config Scl = Portc.5 'Configure I2C SCL Config Sda = Portc.4 'Configure I2C SDA Dim _lcd_e As Byte 'Needed to control 4 line LCD Enable Interrupts Config Lcd = 20 * 4 'configure lcd screen 'other options are 16 * 4 and 20 * 4, 20 * 2 , 16 * 1a 'When you dont include this option 16 * 2 is assumed '16 * 1a is intended for 16 character displays with split addresses over 2 lines _lcd_e = 64 'select E2 Cls Lcd "64_1" 'wird auf 2*16 angezeigt Lowerline Lcd "64_2" 'wird auf 2*16 angezeigt Thirdline Lcd "64_3" Fourthline Lcd "64_4" Wait 1 _lcd_e = 128 'select E1 Cls Lcd "128_1" Lowerline Lcd "128_2" Thirdline Lcd "128_3" Fourthline Lcd "128_4" _lcd_e = 192 'select both halfs for defining characters Cls Lcd "192_1" Lowerline Lcd "192_2" Thirdline Lcd "192_3" Fourthline Lcd "192_4" '------------------------------------------------------------------------------- _lcd_e = 64 'select E2 Cls Locate 1 , 1 Lcd "L64_1" 'wird auf 2*16 angezeigt Locate 2 , 1 Lcd "L64_2" 'wird auf 2*16 angezeigt Locate 3 , 1 Lcd "L64_3" Locate 4 , 1 Lcd "L64_4" Wait 1 _lcd_e = 128 'select E1 Cls Locate 1,1 Lcd "L128_1" Locate 2 , 1 Lcd "L128_2" Locate 3 , 1 Lcd "L128_3" Locate 4 , 1 Lcd "L128_4" _lcd_e = 192 'select both halfs for defining characters Cls Locate 1,1 Lcd "L192_1" 'wird auf 2*16 angezeigt Locate 2 , 1 Lcd "L192_2" 'wird auf 2*16 angezeigt Locate 3 , 1 Lcd "L192_3" Locate 4 , 1 Lcd "L192_4" Do Loop End







Zitieren

Lesezeichen