LCD_IO 3

Using connection mode 3:

This method uses a Data and a Clock line via a shift register to control the LCD display plus an Enable line. This method is used when the LCD is connected through a shift register IC using a LS74574.

This connection method is also called a 3-wire connection.

The diagram below shows a method to connect the LCD to a microcontroller.

graphic

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 3-bit mode only three constants must be set.

Constant Name Controls Default Value

LCD_IO

The I/O mode.

3

LCD_DB

The data pin used in 3-bit mode.

Mandated

LCD_CB

The clock pin used in 3- bit mode.

Mandated

LCD_EB

The enable pin used in 3- bit mode.

Mandated

Example:

    #chip 16f628a, 4
    #option explicit

    ;Setup LCD Parameters
    #define LCD_IO 3

    'Change ports as necessary
    #define LCD_DB     PORTb.3            ; databit
    #define LCD_CB     PORTb.4            ; clockbit
    #define LCD_EB     PORTa.0            ; enable bit

      Dim BV as Byte


    'Program Start

     PRINT "GCBASIC"
     Locate 1,0
     PRINT "@2021"
     Wait 4 s

      DO Forever
           CLS
           WAIT 2 s
           PRINT "Test LCDHex "
           wait 3 s
           CLS
           wait 1 s


       for bv = 0 to 16
         locate 0,0
         Print "DEC " : Print BV
         locate 1,0
         Print "HEX "
         LCDHex BV
         Locate 1, 8
         LCDHEX BV, LeadingZeroActive

         wait 500 ms
       next
           CLS
           wait 1 s
           Print "END TEST"
      LOOP

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 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