Using connection mode 4:
To use connection mode 4 the R/W, RS, Enable control lines and the highest 4 data lines (DB4 through DB7) must be connected to the microcontroller.
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. Constants required for connection mode 4.
Constants are required for 4-bit mode as follows.
| Constant Name | Controls | Default Value |
|---|---|---|
|
|
|
|
|
|
Must be 4 |
|
|
|
Specifies the output pin that is connected to Register Select on the LCD. |
Must be defined as |
|
|
Specifies the output pin that is connected to Read/Write on the LCD. The R/W pin can be disabled*. |
Must be defined as |
|
|
Specifies the output pin that is connected to Read/Write on the LCD. |
Must be defined as |
|
|
Output pin used to interface with bit 4 of the LCD data bus |
Must be defined as |
|
|
Output pin used to interface with bit 5 of the LCD data bus |
Must be defined as |
|
|
Output pin used to interface with bit 6 of the LCD data bus |
Must be defined as |
|
|
Output pin used to interface with bit 7 of the LCD data bus |
Must be defined as |
|
|
Specifies a delay between transmission of data nibbles to LCD or VFD. Usage must include number value and unit of time.
Only applicable when using LCD_IO 4 |
None. |
|
|
Specifies OCULAR OM1614 suppport. This changes the intialisation routine to a specific routine for the OCULAR devices. |
To specify explicit OCULAR_OM1614 support
The OCULAR devices requires LCD_RW |
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 4: a 4-bit parallel connection using the LCD's
' upper four data lines (DB4-DB7), plus RS and Enable. R/W is disabled
' here (LCD_NO_RW), so the LCD's R/W pin must be tied to ground.
#define LCD_IO 4
#define LCD_NO_RW
#define LCD_RS PORTA.7
#define LCD_Enable PORTA.6
#define LCD_DB4 PORTB.4
#define LCD_DB5 PORTB.5
#define LCD_DB6 PORTB.6
#define LCD_DB7 PORTB.7
CLS
Print "Hello World." ' <<< the print instruction this page documents
EndKey line: Print "Hello World." — each character is written as two 4-bit nibbles over LCD_DB4-LCD_DB7, strobed by LCD_Enable, exactly as the physical LCD’s HD44780-style controller expects in 4-bit mode.
Also see further code examples at Four 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_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 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

