LCD_IO 2_74xx164

Using connection mode 2_74XX164:

Use a Data and a Clock line. This manner is used when the LCD is connected through a shift register IC either using a 74HC164 or a 74LS164, as detailed at here. This connection method is also called a 2-wire connection.

This is the preferred two wire method to connect via a shift register to an LCD display.

Relevant Constants:

Specific constants are used to control settings for the Liquid Crystal Display routines included with GCBASIC. To set these constants the main program should specific constants to support the connection mode using #define.

When using connection mode 2_74XX164 only three constants must be set - all others are optional or can be ignored.

Constant Name Controls Default Value

LCD_IO

The I/O mode.

2

LCD_DB

The data pin used in 2-bit mode.

Mandated

LCD_CB

The clock pin used in 2- bit mode.

Mandated

LCD.h supports in connection mode 2_74XX164 via the control of pin 11 of the 74HC164 / 74LS164 the background led/backlight.

How to connect and control the LCD background led: see LCDBacklight.

Example:

    #chip mega8, 8

    ' Connection mode 2_74XX164: a Data and a Clock line drive a 74HC164/74LS164
    ' shift register, which in turn drives the LCD. This is the preferred
    ' 2-wire method; pin 11 of the shift register controls the backlight.
    #define LCD_IO 2_74XX164
    #define LCD_DB PORTC.0
    #define LCD_CB PORTC.1
    #define LCD_NO_RW

    LCDBacklight On

    CLS
    Print "GCBASIC"
    Locate 1,0
    Print "  Hello World."          ' <<< the print instruction this page documents

Key line: Print " Hello World." — writes to the second LCD line after Locate 1,0; both Print calls are shifted out over LCD_DB/LCD_CB to the 74HC164/74LS164, which the LCD itself decodes back into an 8-bit parallel write.

See further code examples at Two Wire LCD Solutions.

See the separate sections of the Help file for the specifics of each Connection Mode.

See Also:

  • LCD_IO 0 — single subroutine, software-driven mode
  • LCD_IO 1 — 1-wire, via a 74HC595 shift register
  • LCD_IO 2 — 2-wire shift register, deprecated
  • LCD_IO 2_74xx174 — 2-wire via 74LS174, deprecated
  • LCD_IO 3 — 3-wire shift register with an added Enable line
  • LCD_IO 4 — 4-bit parallel connection
  • LCD_IO 8 — 8-bit parallel connection
  • LCD_IO 10 — I2C via a PCF8574/PCF8574A I/O expander
  • LCD_IO 12 — I2C via a Ywmjkdz-layout adapter
  • LCD_IO 14 — SPI expander
  • LCD_IO 16 — PIC16LF72 SPI expander
  • LCD_IO 107 — K107 serial adapter