LCDproc development and user support list

Text archives Help


[Lcdproc] I2C-LCD with 2 enable lines


Chronological Thread 
  • From: kripton AT kripserver.net (Jannis Achstetter)
  • Subject: [Lcdproc] I2C-LCD with 2 enable lines
  • Date: Thu Mar 13 19:58:02 2008

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stefan Herdler schrieb:
| Hi,
| Carsten Tschense wrote:
|> Hi,
|> I already tried modifying the code and I ended up with this, which
|> displays the initial HD44780-message and then crashes:
|>
|> --- lcdproc-0.5.0/server/drivers/hd44780-i2c.c.old 2006-04-07
|> 16:54:29.000000000 +0200
|> +++ lcdproc-0.5.0/server/drivers/hd44780-i2c.c 2006-11-13
|> 15:50:37.000000000 +0100
|> @@ -72,12 +72,12 @@
|> // HD44780_readkeypad
|>
|> void i2c_HD44780_senddata (PrivateData *p, unsigned char displayID,
|> unsigned char flags, unsigned char ch);
|> -void i2c_HD44780_backlight (PrivateData *p, unsigned char state);
|> +// void i2c_HD44780_backlight (PrivateData *p, unsigned char state);
|>
|> #define RS 0x10
|> #define RW 0x20
|> -#define EN 0x40
|> -#define BL 0x80
|> +#define EN1 0x40
|> +#define EN2 0x80
|> // note that the above bits are all meant for the data port of PCF8574
|>
|> #define I2C_ADDR_MASK 0x7f
|> @@ -113,9 +113,9 @@
|> PrivateData *p = (PrivateData*) drvthis->private_data;
|> HD44780_functions *hd44780_functions = p->hd44780_functions;
|>
|> - int enableLines = EN;
|> + int enableLines = EN1 | EN2;
|> char device[256] = DEFAULT_DEVICE;
|> - p->backlight_bit = BL;
|> + // p->backlight_bit = BL;
|>
|> /* READ CONFIG FILE */
|>
|> @@ -154,7 +154,7 @@
|> }
|>
|> hd44780_functions->senddata = i2c_HD44780_senddata;
|> - hd44780_functions->backlight = i2c_HD44780_backlight;
|> + hd44780_functions->backlight = NULL;
|> hd44780_functions->scankeypad = NULL;
|>
|> // powerup the lcd now
|> @@ -221,9 +221,11 @@
|> else //if (flags == RS_DATA)
|> portControl = RS;
|>
|> - portControl |= p->backlight_bit;
|> -
|> - enableLines = EN;
|> + //portControl |= p->backlight_bit;
|> +
|> + enableLines = EN1;
|> + if (displayID == 0) enableLines = EN1 | EN2;
|> + else if (displayID == 2) enableLines = EN2;
|>
|> i2c_out(p, portControl | h);
|> if (p->delayBus)
|> @@ -242,9 +244,9 @@
|> i2c_out(p, portControl | l);
|> }
|>
|> -void i2c_HD44780_backlight (PrivateData *p, unsigned char state)
|> +/*void i2c_HD44780_backlight (PrivateData *p, unsigned char state)
|> {
|> p->backlight_bit = ((!p->have_backlight||state) ? 0 : BL);
|>
|> i2c_out(p, p->backlight_bit);
|> -}
|> +}*/
|>
|> Please don't laugh at me, I'm not saying I can code C... ;)
|>
| At the first glance looks almost like what I would have tried.
|
| I'm not an HD44780-expert but doesn't showing the "initial HD44780
| message" mean the init() function has been completed successfully?
| So the i2c_HD44780_senddata() has to be o.k. too (at least if the
| displayID is 0).
|> Suggestions?
|>

Hello there,

I just needed to do the same thing (40x4 over I²C) and I found out why
it didn't work you:
LCDd tries to set the backlight to 1, no matter if there's a
backlight-function or not. So, don't comment it out, don't set it to
NULL and just remove the contents. This way it worked for me ;)

Greetings,
Jannis

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH2Yc+eYlewm37lbgRAtUOAJ9++0trS99ZnlVKihj9cDIrk/s02wCfS73x
F1bIo/k243Ar6BauFhrxfP4=
=//aW
-----END PGP SIGNATURE-----




Archive powered by MHonArc 2.6.18.

Top of page