Go Down

Topic: Yet another LiquidCrystal_I2C library (Read 932 times) previous topic - next topic

bperrybap

As far as the programmer is concerned they are.
My point being that the the LCD is not necessarily processing 3 function set instructions even if the host thinks it is sending 3 by setting up the data lines and strobing E three times.

The LCD may only process 2 function set commands from those 3 strobes of E.
The host is driving the upper data pins (d4 to d7) and possibly the lower d0-d3 pins but not necessarily.
When E is strobed, the LCD pulls in either a nibble using d4-d7 or a full byte using d0-d7 depending on whether it is in 4 bit or 8 bit mode.
If the LCD was in 4 bit mode, there will not be three hd44780 function set instructions processed by the LCD for that sequence.
And that is the point, and why it matters, and why there must be three of these E strobes with the Function set bit pattern on D4-d7 done to get reliably get the LCD back into 8 bit mode and why the first delay after sending the initial instruction nibble is longer than the others.

-- bill

enjoyneering

#16
Sep 06, 2016, 04:16 pm Last Edit: Sep 06, 2016, 04:53 pm by enjoyneering
Now all we have to do is agree on what what we want to call that sequence.   If the device had a hardware input to achieve the same result it would probably be called 'reset'. . . .


I would called it "soft reset". During the power up the LCD does hard reset by itself. After the power up, if you reset just an arduino you have to do the "soft reset" or turn off/on screen manually to trigger the hard reset.

enjoyneering

As I mentioned,  the library can work with custom i2c shields.

LiquidCrystal_I2C lcd(PCF8574_ADDR_A21_A11_A01, 4, 5, 6, 16, 11, 12, 13, 14, POSITIVE);

Where LCD pin no.4 connected to PCF8574 port P0 (pin 4),  LCD pin no.5 connected to PCF8574 port P1 (pin 5),
LCD pin no.6 connected to PCF8574 port P2 (pin 6), LCD pin no.16 connected to PCF8574 port P3 (pin 7) and etc

for example if for some reason the LCD pin no.4 connected to PCF8574 port P7 (pin 12) and LCD pin no.14 connected to PCF8574 port P0 (pin 4). Your initialization string will be:

LiquidCrystal_I2C lcd(PCF8574_ADDR_A21_A11_A01, 14, 5, 6, 16, 11, 12, 13, 4, POSITIVE);

The library was almost finished a while ago, the real trick for me was to make it work with any custom shields.

julyjim

As I mentioned,  the library can work with custom i2c shields.

LiquidCrystal_I2C lcd(PCF8574_ADDR_A21_A11_A01, 4, 5, 6, 16, 11, 12, 13, 14, POSITIVE);

Where LCD pin no.4 connected to PCF8574 port P0 (pin 4),  LCD pin no.5 connected to PCF8574 port P1 (pin 5),
LCD pin no.6 connected to PCF8574 port P2 (pin 6), LCD pin no.16 connected to PCF8574 port P3 (pin 7) and etc

for example if for some reason the LCD pin no.4 connected to PCF8574 port P7 (pin 12) and LCD pin no.14 connected to PCF8574 port P0 (pin 4). Your initialization string will be:

LiquidCrystal_I2C lcd(PCF8574_ADDR_A21_A11_A01, 14, 5, 6, 16, 11, 12, 13, 4, POSITIVE);

The library was almost finished a while ago, the real trick for me was to make it work with any custom shields.
I do not use shields, however, I was under the impression that shield is an hardware interface to processor board hence  the LCD I2C shield connection is the I2C  - two wire interface - if you prefer to call it that way.
So  I2C LCD shield hardware should be concerned only with the I2C interface pins.

The hardware  interface between PCF8574 and the LCD itself , or customization, is just a matter of passing correct parameters to the  class constructor.
Jim 






bperrybap

maybe "shields" means "LCD backpack"?

enjoyneering


enjoyneering

made couple of changes in the lib

- fixed bug in backlight(), noBacklight()
- code a little bit smaller
- fixed problem with ESP8266 (crashed and rebooted before some times)

Go Up