LCD_IO 8

Using connection mode 8:

Using connection mode will require R/W, RS, Enable and all 8 data lines.

The data lines must all be connected to the same I/O port, in sequential order. For example, DB0 to PORTB.0, DB1 to PORTB.1 and so on, with DB7 going to PORTB.7.

Relevant Constants:

These constants are used to control settings for the Liquid Crystal Display routines included with GCBASIC. To set them, place a line in the main program file that uses #define to assign a value to the particular constant.

Constants are required for 8-bit mode as follows.

Constant Name Controls Default Value

LCD_SPEED

FAST, MEDIUM or SLOW.

MEDIUM

LCD_IO

The I/O mode. Can be 2, 4 or 8.

8

LCD_RS

Specifies the output pin that is connected to Register Select on the LCD.

Must be defined

LCD_RW

Specifies the output pin that is connected to Read/Write on the LCD. The R/W pin can be disabled*.

Must be defined (unless R/W is disabled)

LCD_Enable

Specifies the output pin that is connected to Read/Write on the LCD.

Must be defined

LCD_DATA_PORT

Output port used to interface with LCD data bus

Must be defined

LCD_LAT

Drives the port with LATx support. Resolves issues with faster Mhz and the Microchip PIC read/write/modify feature. See example below.

Optional

The R/W pin can be disabled by setting the LCD_NO_RW constant. If this is done, there is no need for the R/W to be connected to the chip, and no need for the LCD_RW constant to be set. Ensure that the R/W line on the LCD is connected to ground if not used.

Example:

    #chip 16F877A, 20

    ' Connection mode 8: a full 8-bit parallel connection. All 8 data lines
    ' share one port, in sequential order (DB0 to bit 0, DB7 to bit 7).
    ' R/W is disabled here (LCD_NO_RW), so tie the LCD's R/W pin to ground.
    #define LCD_IO 8
    #define LCD_NO_RW

    #define LCD_DATA_PORT PORTB
    #define LCD_RS PORTA.7
    #define LCD_Enable PORTA.6

    CLS

    Print "Hello World."          ' <<< the print instruction this page documents

    END

Key line: Print "Hello World." — writes each character to LCD_DATA_PORT as a full 8-bit parallel value, strobed by LCD_Enable, in a single write per character rather than the two nibble-writes that 4-bit mode requires.

For further code examples see Eight Wire Examples.

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_74xx164 — 2-wire via 74HC164/74LS164, the preferred 2-wire method
  • 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 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