LCD

Module NameLCD
Import NameLCD

The LCD module is designed to support the Hitachi HD44780 LCD controller.

Options

WriteCommand

  Sub WriteCommand(cmd As Byte)
  • cmd - Command byte to write.

Write a command to the LCD. The command byte can be:

  • cmdCGRAM
  • cmdDDRAM
  • cmdClear
  • cmdHome
  • cmdCursorOff
  • cmdCursorOn
  • cmdBlinkOn
  • cmdBlinkOff
  • cmdMoveLeft
  • cmdMoveRight

SetCursor

  Sub SetCursor(line As Byte, column As Byte)
  • line - LCD line number. The line number starts at 1.
  • column - LCD column. The column number starts at 1.

Set the cursor to line and column.

Write

 Compound Sub Write(item)
  • item - Item to write. Can be a byte, string or constant byte array.

Write one or more items to the LCD.

WriteAt

 Compound Sub WriteAt(line As Byte, column As Byte, item)
  • line - LCD line number. The line number starts at 1.
  • column - LCD column. The column number starts at 1.
  • item - Item to write. Can be a byte, string or constant byte array.

Write one or more items to the LCD at location line, column.

Clear

 Sub Clear()

Clear the LCD screen.

#option LCD_INTERFACE

The LCD_INTERFACE option sets the module to either 4 or 8 bit mode. The default is 4 bit mode. For 8 bit mode, the default pins are:

#option LCD_D0 = D0
#option LCD_D1 = D1
#option LCD_D2 = D2
#option LCD_D3 = D3
#option LCD_D4 = D4
#option LCD_D5 = D5
#option LCD_D6 = D6
#option LCD_D7 = D7

Note that using 8 bit mode requires the user to disable the hardware UART, which is by default connected to pins D0 and D1. If using 4 bit mode, the default pins are:

#option LCD_D0 = D4
#option LCD_D1 = D5
#option LCD_D2 = D6
#option LCD_D3 = D7

#option LCD_RS

The LCD reset pin. Default is D8.

#option LCD_EN

The LCD enable pin. Default is D9

#option LCD_COMMAND_US

The LCD_COMMAND_US option sets the delay value after a command write. Values can be ranged between 1 and 65535. If the LCD_COMMAND_US option is not used, it defaults to 2000.

#option LCD_DATA_US

The LCD_DATA_US option sets the delay value after a data write. Values can be ranged between 1 and 255. If the LCD_DATA_US option is not used, it defaults to 50.

#option LCD_INIT_DELAY

The LCD_INIT_DELAY option sets the delay (ms) before the module is initialised. Values can be ranged between 0 and 1000. If LCD_INIT_DELAY option is not used, it defaults to 100.