1

I can't seem to figure out what the numbers in after 0x27 means. I understand that 0x27 stands for I2C address and POSITIVE stands for the back light, but what does the other numbers mean?

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE)

  • 1
    Which LiquidCrystal_I2C library are you using? Usually you would call the constructor like this: LiquidCrystal_I2C lcd(0x27, LCD columns, LCD rows);. – VE7JRO Mar 8 at 9:29
  • 1
    My guess is they refer to the pins on the IO expander to use for the different pin functions. Without knowing what library you are using, or what LCD display and interface board you have, it's impossible to say. – Majenko Mar 8 at 11:08
  • A “4x20” LCD is one with 4 rows and 20 columns. You can guess a “0x27” has 0 rows and 27 columns. ;-) – Edgar Bonet Mar 9 at 18:47
  • It's a bit late, but I'm using Newliquidcrystal_1.3.5. I don't think it stands for columns x rows. I tried 16, 2 and the LCD didn't work. – J. Doe Mar 11 at 23:26
2

Assuming You're using the same LCD library I'm using, there is a longer form of the constructor that takes pin assignments for the different pins on the I2C module, as Majenko says.

I'm at work, so I don't have access to my code, but your constructor looks a whole lot like the one I use for my module, which has non-standard pin assignment. (I got my LCD modules from oddWires, and they came without documentation. I had to do quite a bit of detective work to figure out how to make them work.)

EDIT

I use the Newliquidcrystal_1.3.5 library in my project, to interface the above-mentioned oddWires I2C LCD display. That library has various constructors, one of which takes all the parameters you list. Those extra numbers indicate the pins that connect to the I2C module.

My oddWires LCDs need exactly the settings you list in the constructor. Your milage may vary.

The long form is defined in the library header with

LiquidCrystal_I2C(
    uint8_t lcd_Addr, 
    uint8_t En, 
    uint8_t Rw, 
    uint8_t Rs,

    uint8_t d4, 
    uint8_t d5, 
    uint8_t d6, 
    uint8_t d7,
    uint8_t backlighPin, 
    t_backlighPol pol
);

From the naming of the parameters you can deduce most of them:

  • En is an enable line
  • Rw is a read/write line?
  • Rs is ?
  • d4-47 are the data pins
  • backlightPin is the pin that turns backlight on and off
  • pol indicates the backlight polarity (POSITIVE probably means pull the line high to enable the backlight.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.