Hast du ein 1-bzw 2-zeiliges Display ? (weil du E2 offenbar nicht brauchst)
Ich hab versucht, bei den relevanten die Bits/Pins entsprechend zu tauschen.
Die geänderten Zeilen hab' ich markiert und die ursprünglichen Zeilen als Kommentar stehen lassen.
Ehrlich gesagt, bei ein paar trickreichen Commands blick' ich im moment nicht ganz durch. Daher logo keine Gewähr
Ich hab nicht gesehen, ob und wie der Herr AnderssonCode:copyright = Kent Andersson www = none email = kent@smmab.se comment = I2C LCD driver libversion = 1.02 date = 31 march 2002 statement = You are free to use this code any way you like, if you are able to optimize statement = it better, please send me an update on my e-mail. history = No known bugs. ;define a constant named PCF8574_LCD pointing to the I2C address ;dimension _lcd_e as byte to control the E-lines (4 lines LCD:s) ;_lcd_e should have one of the following values ;128 to enable E1, 64 to enable E2, 192 to enable both E1 and E2 (cls, deflcdchar) ;Connect the following pins from PCF8574 to LCD ; ; ================= original ====== ;P0 - D4 ;P1 - D5 ;P2 - D6 ;P3 - D7 ;P4 - RS ;P5 - RW (not used, set to 0 to ground for write) ;P6 - E2 (on 1 or 2 line display nc) ;P7 - E1 ; ================= FUNKHELD ====== ;P0 - D4 ;P1 - D5 ;P2 - D6 ;P3 - D7 ;P4 - E1 ;P5 - RW (not used, set to 0 to ground for write) ;P6 - RS ;P7 - nc [_Init_LCD] _Init_LCD: *BASIC: waitms 50 ;----------------------------------------------------------------- ;ldi r16,&hc0 ; this is to make the initialization on both halfs of a 4-line LCD E1 + E2 ;------------------------picnick----------------------------------------- ldi r16,&h10 ; this is to make the initialization on both halfs of a 4-line LCD ;----------------------------------------------------------------- Ldi _temp1, &h03 ; at init-time I call all routines before _lcd_e is loaded into r16 Rcall _Send_to_LCD *BASIC: waitms 4 Rcall _Send_to_LCD Rcall _Send_to_LCD Ldi _temp1, &h02 Rcall _Send_to_LCD Ldi _temp1, &h28 RW + 8 Rcall _Write_lcd_byte ;RS flag should to be 0, so jump directly to write byte ;----------------------------------------------------------------- ;Ldi _temp1, &h08 ;------------------------picnick----------------------------------------- Ldi _temp1, &h40 ;----------------------------------------------------------------- Rcall _Write_lcd_byte Ldi _temp1, &h0c Rcall _Write_lcd_byte Ldi _temp1, &h01 Rjmp _Write_lcd_byte [END] [_Write_lcd] _Write_lcd: * lds r16,{_lcd_e} ;----------------------------------------------------------------- !sbr r16,&h10 ;set RS flag (4 high bits is used as control) RS ;------------------------picnick----------------------------------------- sbr r16,&h40 ;set RS flag (4 high bits is used as control) RS 0x40 ;----------------------------------------------------------------- rjmp _write_lcd_byte _Lcd_Control: * lds r16,{_lcd_e} _write_lcd_byte: push r24 Swap _temp1 Rcall _Write_lcd_Nibble pop r24 _Write_lcd_nibble: Cbr _temp1,&HF0 ; E1, E2, RW, RS low _Send_to_LCD: push r26 push r27 ldi r25,3 _send_3_times: *BASIC: i2csend pcf8574_LCD,_temp1 eor _temp1,R16 ; Xor E1 and/or E2 to set them ; @genus(250) ldi r26,0 _LCD_delay: dec R26 brne _LCD_delay Dec R25 Brne _send_3_times eor _temp1,R16 ; Xor to restore to initial state (even number of times) pop r27 pop r26 ret [END]
"_temp1" festlegt ?
Du weisst eh, dass du irgendwo
CONST PCF8574_LCD = i2c-addresse
und
DIM _lcd_e AS BYTE ' das Byte, das du schreiben willst
definieren musst ?
('tschuldige, wenn das eine überflüssige Frage ist )
Lass mich hören, ob das funzt oder ob das LCD verdampft ist *g*
@Richard offenbar will funkheld das LCD über den PCF betreiben und nicht 8 Pins verbraten. Scheint mir nicht aussergewöhnlich. Aber dadurch sind die Bascom -Einstellungen natürlich sinnlos







Zitieren

Lesezeichen