Module Name | LCDDogm |
Import Name | Dogm |
The LCD module is designed to support the EA DOG series LCD. The interface is compatible with the Hitachi HD44780 LCD controller.
Options
Program Examples
Sub SetBacklight(value As UShort)
Set the LCD Plus backlight. The backlight is connected to the PWM pin D3.
Function GetBacklight() As UShort
Return the current backlight value.
Sub SetContrast(value As Byte)
Sets the LCD contrast.
Function GetContrast() As Byte
Return the current contrast value.
Sub WriteCommand(cmd As Byte)
Write a command to the LCD. The command byte can be:
Sub SetCursor(line As Byte, column As Byte)
Set the cursor to line and column.
Compound Sub Write(item)
Write one or more items to the LCD.
Compound Sub WriteAt(line As Byte, column As Byte, item)
Write one or more items to the LCD at location line, column.
Sub Clear()
Clear the LCD screen.
Sets the LCD to support either two or three line mode. For example,
#option LCD_DOGM = DOGM_162 ' 2 line LCD support #option LCD_DOGM = DOGM_163 ' 3 line LCD support
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
The LCD reset pin. Default is D8.
The LCD enable pin. Default is D9
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.
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.
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.
' file imports... imports LCDDogm ' main program entry point... sub Main() ' set backlight... Dogm.SetBacklight(100) ' clear the LCD and display counter value... Dogm.Clear dim elapsed as ushort = 0 while true Dogm.WriteAt(1,4,"Firewing") Dogm.WriteAt(2,1,"Counter = ", Str(elapsed,5)) elapsed += 1 delayms(1000) end while end sub