LCDproc development and user support list

Text archives Help


[Lcdproc] I2C-LCD with 2 enable lines


Chronological Thread 
  • From: peter AT adpm.de (Peter Marschall)
  • Subject: [Lcdproc] I2C-LCD with 2 enable lines
  • Date: Sat Mar 29 18:34:12 2008

Hi Jannis,

On Thursday, 13. March 2008, Jannis Achstetter wrote:
> 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 =3D (PrivateData*) drvthis->private_data;
> |> HD44780_functions *hd44780_functions =3D p->hd44780_functions;
> |>
> |> - int enableLines =3D EN;
> |> + int enableLines =3D EN1 | EN2;
> |> char device[256] =3D DEFAULT_DEVICE;
> |> - p->backlight_bit =3D BL;
> |> + // p->backlight_bit =3D BL;
> |>
> |> /* READ CONFIG FILE */
> |>
> |> @@ -154,7 +154,7 @@
> |> }
> |>
> |> hd44780_functions->senddata =3D i2c_HD44780_senddata;
> |> - hd44780_functions->backlight =3D i2c_HD44780_backlight;
> |> + hd44780_functions->backlight =3D NULL;
> |> hd44780_functions->scankeypad =3D NULL;
> |>
> |> // powerup the lcd now
> |> @@ -221,9 +221,11 @@
> |> else //if (flags =3D=3D RS_DATA)
> |> portControl =3D RS;
> |>
> |> - portControl |=3D p->backlight_bit;
> |> -
> |> - enableLines =3D EN;
> |> + //portControl |=3D p->backlight_bit;
> |> +
> |> + enableLines =3D EN1;
> |> + if (displayID =3D=3D 0) enableLines =3D EN1 | EN2;
> |> + else if (displayID =3D=3D 2) enableLines =3D 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 =3D ((!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=B2C) 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 ;)

there was a thread about what to do with the setting
[hd44780]
Backlight=3Dno
in the hd44780 driver.

Currently - as you write - LCDd sets backlight off in this case
to set a defined value.

Would it help to ignore the backlight function in the connection types
at all in this case ?

I guess used vSpan=3D2,2 for the connection.

Maybe an alternative could be for the i2c connection type to=20
=2D initialize differently (if needed for the 2nd dislay)
=2D do nothing in the backlight function

Of course, for the later a patch might be very welcome ;-)

Regards
Peter








=2D-=20
Peter Marschall
peter AT adpm.de




Archive powered by MHonArc 2.6.18.

Top of page