LCD_IO 12 Port Configuration

Using mode 12:

When using I2C LCD mode 12 the target I2C device address is setup as shown below. Each bit of the the variable i2c_lcd_byte is defined to address the correct LCD display port.

    i2c_lcd_e = i2c_lcd_byte.4          ' <<< the default Enable bit mapping for mode 12
    i2c_lcd_rw = i2c_lcd_byte.5
    i2c_lcd_rs = i2c_lcd_byte.6
    i2c_lcd_bl = i2c_lcd_byte.7
    i2c_lcd_d4 = i2c_lcd_byte.0
    i2c_lcd_d5 = i2c_lcd_byte.1
    i2c_lcd_d6 = i2c_lcd_byte.2
    i2c_lcd_d7 = i2c_lcd_byte.3

Key line: i2c_lcd_e = i2c_lcd_byte.4 — shows the default bit mapping for the Ywmjkdz-style adapter used by LCD_IO 12; this is fixed library behaviour, shown here only for reference, and is separate from the override syntax below.

If you have an I2C LCD display adapter with a different set of connection of the adapter then change this configuration to suit the specific of the adapter as follows. This should be done in the your main program code.

    #define i2c_lcd_e i2c_lcd_byte.4          ' <<< overriding the default Enable bit mapping
    #define i2c_lcd_rw i2c_lcd_byte.5
    #define i2c_lcd_rs i2c_lcd_byte.6
    #define i2c_lcd_bl i2c_lcd_byte.7
    #define i2c_lcd_d4 i2c_lcd_byte.3
    #define i2c_lcd_d5 i2c_lcd_byte.2
    #define i2c_lcd_d6 i2c_lcd_byte.1
    #define i2c_lcd_d7 i2c_lcd_byte.0

Key line: #define i2c_lcd_e i2c_lcd_byte.4 — redefining any of the eight i2c_lcd_* constants in your own program overrides that single bit mapping, so only the bits that differ from the default on your specific adapter need to be redefined.

See Also: