Difference between revisions of "Unit HD44780"

From Ultibo.org
Jump to: navigation, search
 
(10 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
=== Description ===
 
=== Description ===
 
----
 
----
 +
 +
'''Hitachi HD44780 LCD Controller Driver unit'''
  
 
The Hitachi HD44780 is a dot matrix liquid crystal display controller. It supports 5x8 or 5x10 characters and includes a 240 character font in ROM, 80 bytes of character RAM and 64 bytes of character generator RAM for custom characters.
 
The Hitachi HD44780 is a dot matrix liquid crystal display controller. It supports 5x8 or 5x10 characters and includes a 240 character font in ROM, 80 bytes of character RAM and 64 bytes of character generator RAM for custom characters.
Line 16: Line 18:
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HD44780 specific constants''' <code> HD44780_CONSOLE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HD44780_CONSOLE_DESCRIPTION = 'Hitachi HD44780 LCD Controller';</code>
 +
| Description of HD44780 device
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HD44780 instruction''' <code> HD44780_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HD44780_CLEARDISPLAY = $01;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HD44780_RETURNHOME = $02;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_ENTRYMODESET = $04;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_DISPLAYCONTROL = $08;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_CURSORSHIFT = $10;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_FUNCTIONSET = $20;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_SETCGRAMADDR = $40;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_SETDDRAMADDR = $80;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HD44780 entry mode set''' <code> HD44780_ENTRYMODESET_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HD44780_ENTRYMODESET_RIGHT = $00;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HD44780_ENTRYMODESET_LEFT = $02;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_ENTRYMODESET_SHIFTINC = $01;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_ENTRYMODESET_SHIFTDEC = $00;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HD44780 display control''' <code> HD44780_DISPLAYCONTROL_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HD44780_DISPLAYCONTROL_DISPLAYON = $04;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HD44780_DISPLAYCONTROL_DISPLAYOFF = $00;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_DISPLAYCONTROL_CURSORON = $02;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_DISPLAYCONTROL_CURSOROFF = $00;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_DISPLAYCONTROL_BLINKON = $01;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_DISPLAYCONTROL_BLINKOFF = $00;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HD44780 cursor shift''' <code> HD44780_CURSORSHIFT_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HD44780_CURSORSHIFT_DISPLAY = $08;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HD44780_CURSORSHIFT_CURSOR = $00;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_CURSORSHIFT_RIGHT = $04;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_CURSORSHIFT_LEFT = $00;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HD44780 function set''' <code> HD44780_FUNCTIONSET_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HD44780_FUNCTIONSET_8BITMODE = $10;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HD44780_FUNCTIONSET_4BITMODE = $00;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_FUNCTIONSET_2LINE = $08;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_FUNCTIONSET_1LINE = $00;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_FUNCTIONSET_5X10DOTS = $04;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HD44780_FUNCTIONSET_5X8DOTS = $00;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HD44780 row offset''' <code> HD44780_ROW_OFFSETS* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|4 rows
 +
|-
 +
|colspan="2"|<code>HD44780_ROW_OFFSETS:array[0..3] of Byte = ($00,$40,$14,$54);</code>
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===
 
----
 
----
  
''To be documented''
+
 
 +
'''HD44780 character'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHD44780Character = ^THD44780Character;</code>
 +
 
 +
<code>THD44780Character = array[0..7] of Byte;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HD44780 console'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHD44780Console = ^THD44780Console;</code>
 +
 
 +
<code>THD44780Console = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Console Properties''
 +
|-
 +
| <code>Console:TConsoleDevice;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''HD44780 Properties''
 +
|-
 +
| <code>GPIO:PGPIODevice;</code>
 +
| The GPIO device this Console is connected to
 +
|-
 +
| <code>RS:LongWord;</code>
 +
| The GPIO pin for the RS line
 +
|-
 +
| <code>RW:LongWord;</code>
 +
| The GPIO pin for the RW line
 +
|-
 +
| <code>EN:LongWord;</code>
 +
| The GPIO pin for the EN line
 +
|-
 +
| <code>D4:LongWord;</code>
 +
| The GPIO pin for the D4 line
 +
|-
 +
| <code>D5:LongWord;</code>
 +
| The GPIO pin for the D5 line
 +
|-
 +
| <code>D6:LongWord;</code>
 +
| The GPIO pin for the D6 line
 +
|-
 +
| <code>D7:LongWord;</code>
 +
| The GPIO pin for the D7 line
 +
|-
 +
| <code>EntryMode:Byte;</code>
 +
| Current value of the Entry Mode settings
 +
|-
 +
| <code>FunctionSet:Byte;</code>
 +
| Current value of the Function Set settings
 +
|-
 +
| <code>DisplayControl:Byte;</code>
 +
| Current value of the Display Control settings
 +
|-
 +
|colspan="2"|''Cursor Properties''
 +
|-
 +
| <code>CursorX:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>CursorY:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Buffer Properties''
 +
|-
 +
| <code>Size:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Buffer:PByte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
''None defined''
  
 
=== Function declarations ===
 
=== Function declarations ===
Line 40: Line 272:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 52: Line 284:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 63: Line 295:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleOpen(Console:PConsoleDevice):LongWord;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleOpen(Console:PConsoleDevice):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of ConsoleDeviceOpen API for HD44780</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| None documented
+
| Not intended to be called directly by applications, use ConsoleDeviceOpen instead.
 
|-
 
|-
 
|}
 
|}
Line 75: Line 307:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleClose(Console:PConsoleDevice):LongWord;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleClose(Console:PConsoleDevice):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of ConsoleDeviceClose API for HD44780</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| None documented
+
| Not intended to be called directly by applications, use ConsoleDeviceClose instead.
 
|-
 
|-
 
|}
 
|}
Line 87: Line 319:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleClear(Console:PConsoleDevice; Color:LongWord):LongWord;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleClear(Console:PConsoleDevice; Color:LongWord):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of ConsoleDeviceClear API for HD44780</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| None documented
+
| Not intended to be called directly by applications, use ConsoleDeviceClear instead.
 
|-
 
|-
 
|}
 
|}
Line 99: Line 331:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleScroll(Console:PConsoleDevice; X1,Y1,X2,Y2,Count,Direction:LongWord):LongWord;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleScroll(Console:PConsoleDevice; X1,Y1,X2,Y2,Count,Direction:LongWord):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of ConsoleDeviceScroll API for HD44780</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| None documented
+
| Not intended to be called directly by applications, use ConsoleDeviceScroll instead.
 
|-
 
|-
 
|}
 
|}
Line 111: Line 343:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleDrawChar(Console:PConsoleDevice; Handle:TFontHandle; Ch:Char; X,Y,Forecolor,Backcolor:LongWord):LongWord;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleDrawChar(Console:PConsoleDevice; Handle:TFontHandle; Ch:Char; X,Y,Forecolor,Backcolor:LongWord):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of ConsoleDeviceDrawChar API for HD44780</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| None documented
+
| Not intended to be called directly by applications, use ConsoleDeviceDrawChar instead.
 
|-
 
|-
 
|}
 
|}
Line 123: Line 355:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleDrawText(Console:PConsoleDevice; Handle:TFontHandle; const Text:String; X,Y,Forecolor,Backcolor,Len:LongWord):LongWord;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleDrawText(Console:PConsoleDevice; Handle:TFontHandle; const Text:String; X,Y,Forecolor,Backcolor,Len:LongWord):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of ConsoleDeviceDrawText API for HD44780</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| None documented
+
| Not intended to be called directly by applications, use ConsoleDeviceDrawText instead.
 
|-
 
|-
 
|}
 
|}
Line 135: Line 367:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleDrawBlock(Console:PConsoleDevice; X1,Y1,X2,Y2,Color:LongWord):LongWord;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleDrawBlock(Console:PConsoleDevice; X1,Y1,X2,Y2,Color:LongWord):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of ConsoleDeviceDrawBlock API for HD44780</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| None documented
+
| Not intended to be called directly by applications, use ConsoleDeviceDrawBlock instead.
 
|-
 
|-
 
|}
 
|}
Line 146: Line 378:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleDrawWindow(Console:PConsoleDevice; Handle:TWindowHandle):LongWord;</pre>
+
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleDrawWindow(Console:PConsoleDevice; Handle:TWindowHandle; Flags:LongWord):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of ConsoleDeviceDrawWindow API for HD44780</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Caller must hold the Window lock
 
| Caller must hold the Window lock
 +
Not intended to be called directly by applications, use ConsoleDeviceDrawWindow instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsolePutText(Console:PConsoleDevice; Handle:TFontHandle; const Source,Dest:TConsolePoint; Buffer:PConsoleChar; Width,Height,Skip:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of ConsoleDevicePutText API for HD44780</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Not intended to be called directly by applications, use ConsoleDevicePutText instead.
 
|-
 
|-
 
|}
 
|}
Line 159: Line 404:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleGetPosition(Console:PConsoleDevice; Position:LongWord; var X1,Y1,X2,Y2:LongWord):LongWord;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function HD44780ConsoleGetPosition(Console:PConsoleDevice; Position:LongWord; var X1,Y1,X2,Y2:LongWord):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of ConsoleDeviceGetPosition API for HD44780</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| None documented
+
| Not intended to be called directly by applications, use ConsoleDeviceGetPosition instead.
 
|-
 
|-
 
|}
 
|}
Line 178: Line 423:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Caller must hold the Console lock
 
| Caller must hold the Console lock
 
|-
 
|-
Line 190: Line 435:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Caller must hold the Console lock
 
| Caller must hold the Console lock
 
|-
 
|-
Line 202: Line 447:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Caller must hold the Console lock
 
| Caller must hold the Console lock
 
|-
 
|-
Line 214: Line 459:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Caller must hold the Console lock
 
| Caller must hold the Console lock
 
|-
 
|-
Line 226: Line 471:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Caller must hold the Console lock
 
| Caller must hold the Console lock
 
|-
 
|-
Line 238: Line 483:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Caller must hold the Console lock
 
| Caller must hold the Console lock
 
|-
 
|-
Line 250: Line 495:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Caller must hold the Console lock
 
| Caller must hold the Console lock
 
|-
 
|-
Line 262: Line 507:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Caller must hold the Console lock
 
| Caller must hold the Console lock
 
|-
 
|-
Line 274: Line 519:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Caller must hold the Console lock
 
| Caller must hold the Console lock
 
|-
 
|-

Latest revision as of 05:43, 31 August 2021

Return to Unit Reference


Description


Hitachi HD44780 LCD Controller Driver unit

The Hitachi HD44780 is a dot matrix liquid crystal display controller. It supports 5x8 or 5x10 characters and includes a 240 character font in ROM, 80 bytes of character RAM and 64 bytes of character generator RAM for custom characters.

The device support 4 bit or 8 bit modes, and has a range of standard functions for display clear, display on/off, cursor on/off, character blink, cursor shift etc.

This unit creates a Console device to represent the LCD and provides the standard console device functions (where appropriate) to draw text, clear the screen, scroll text and manage the cursor.

Currently only 4 bit mode is supported but extension to include 8 bit mode is possible with some additional setup and support functions.

Constants



HD44780 specific constants HD44780_CONSOLE_*
HD44780_CONSOLE_DESCRIPTION = 'Hitachi HD44780 LCD Controller'; Description of HD44780 device


HD44780 instruction HD44780_*
HD44780_CLEARDISPLAY = $01;  
HD44780_RETURNHOME = $02;  
HD44780_ENTRYMODESET = $04;  
HD44780_DISPLAYCONTROL = $08;  
HD44780_CURSORSHIFT = $10;  
HD44780_FUNCTIONSET = $20;  
HD44780_SETCGRAMADDR = $40;  
HD44780_SETDDRAMADDR = $80;  


HD44780 entry mode set HD44780_ENTRYMODESET_*
HD44780_ENTRYMODESET_RIGHT = $00;  
HD44780_ENTRYMODESET_LEFT = $02;  
HD44780_ENTRYMODESET_SHIFTINC = $01;  
HD44780_ENTRYMODESET_SHIFTDEC = $00;  


HD44780 display control HD44780_DISPLAYCONTROL_*
HD44780_DISPLAYCONTROL_DISPLAYON = $04;  
HD44780_DISPLAYCONTROL_DISPLAYOFF = $00;  
HD44780_DISPLAYCONTROL_CURSORON = $02;  
HD44780_DISPLAYCONTROL_CURSOROFF = $00;  
HD44780_DISPLAYCONTROL_BLINKON = $01;  
HD44780_DISPLAYCONTROL_BLINKOFF = $00;  


HD44780 cursor shift HD44780_CURSORSHIFT_*
HD44780_CURSORSHIFT_DISPLAY = $08;  
HD44780_CURSORSHIFT_CURSOR = $00;  
HD44780_CURSORSHIFT_RIGHT = $04;  
HD44780_CURSORSHIFT_LEFT = $00;  


HD44780 function set HD44780_FUNCTIONSET_*
HD44780_FUNCTIONSET_8BITMODE = $10;  
HD44780_FUNCTIONSET_4BITMODE = $00;  
HD44780_FUNCTIONSET_2LINE = $08;  
HD44780_FUNCTIONSET_1LINE = $00;  
HD44780_FUNCTIONSET_5X10DOTS = $04;  
HD44780_FUNCTIONSET_5X8DOTS = $00;  


HD44780 row offset HD44780_ROW_OFFSETS*
4 rows
HD44780_ROW_OFFSETS:array[0..3] of Byte = ($00,$40,$14,$54);


Type definitions



HD44780 character

PHD44780Character = ^THD44780Character;

THD44780Character = array[0..7] of Byte;

   

HD44780 console

PHD44780Console = ^THD44780Console;

THD44780Console = record

Console Properties
Console:TConsoleDevice;  
HD44780 Properties
GPIO:PGPIODevice; The GPIO device this Console is connected to
RS:LongWord; The GPIO pin for the RS line
RW:LongWord; The GPIO pin for the RW line
EN:LongWord; The GPIO pin for the EN line
D4:LongWord; The GPIO pin for the D4 line
D5:LongWord; The GPIO pin for the D5 line
D6:LongWord; The GPIO pin for the D6 line
D7:LongWord; The GPIO pin for the D7 line
EntryMode:Byte; Current value of the Entry Mode settings
FunctionSet:Byte; Current value of the Function Set settings
DisplayControl:Byte; Current value of the Display Control settings
Cursor Properties
CursorX:Byte;  
CursorY:Byte;  
Buffer Properties
Size:LongWord;  
Buffer:PByte;  


Public variables


None defined

Function declarations



HD44780 functions

function HD44780ConsoleCreate(GPIO:PGPIODevice; const Name:String; Width,Height,RS,RW,EN,D4,D5,D6,D7:LongWord):PConsoleDevice;
Description: To be documented
Note None documented


function HD44780ConsoleDestroy(Console:PConsoleDevice):LongWord;
Description: To be documented
Note None documented


HD44780 console functions

function HD44780ConsoleOpen(Console:PConsoleDevice):LongWord;
Description: Implementation of ConsoleDeviceOpen API for HD44780
Note Not intended to be called directly by applications, use ConsoleDeviceOpen instead.


function HD44780ConsoleClose(Console:PConsoleDevice):LongWord;
Description: Implementation of ConsoleDeviceClose API for HD44780
Note Not intended to be called directly by applications, use ConsoleDeviceClose instead.


function HD44780ConsoleClear(Console:PConsoleDevice; Color:LongWord):LongWord;
Description: Implementation of ConsoleDeviceClear API for HD44780
Note Not intended to be called directly by applications, use ConsoleDeviceClear instead.


function HD44780ConsoleScroll(Console:PConsoleDevice; X1,Y1,X2,Y2,Count,Direction:LongWord):LongWord;
Description: Implementation of ConsoleDeviceScroll API for HD44780
Note Not intended to be called directly by applications, use ConsoleDeviceScroll instead.


function HD44780ConsoleDrawChar(Console:PConsoleDevice; Handle:TFontHandle; Ch:Char; X,Y,Forecolor,Backcolor:LongWord):LongWord;
Description: Implementation of ConsoleDeviceDrawChar API for HD44780
Note Not intended to be called directly by applications, use ConsoleDeviceDrawChar instead.


function HD44780ConsoleDrawText(Console:PConsoleDevice; Handle:TFontHandle; const Text:String; X,Y,Forecolor,Backcolor,Len:LongWord):LongWord;
Description: Implementation of ConsoleDeviceDrawText API for HD44780
Note Not intended to be called directly by applications, use ConsoleDeviceDrawText instead.


function HD44780ConsoleDrawBlock(Console:PConsoleDevice; X1,Y1,X2,Y2,Color:LongWord):LongWord;
Description: Implementation of ConsoleDeviceDrawBlock API for HD44780
Note Not intended to be called directly by applications, use ConsoleDeviceDrawBlock instead.


function HD44780ConsoleDrawWindow(Console:PConsoleDevice; Handle:TWindowHandle; Flags:LongWord):LongWord;
Description: Implementation of ConsoleDeviceDrawWindow API for HD44780
Note Caller must hold the Window lock

Not intended to be called directly by applications, use ConsoleDeviceDrawWindow instead.


function HD44780ConsolePutText(Console:PConsoleDevice; Handle:TFontHandle; const Source,Dest:TConsolePoint; Buffer:PConsoleChar; Width,Height,Skip:LongWord):LongWord;
Description: Implementation of ConsoleDevicePutText API for HD44780
Note Not intended to be called directly by applications, use ConsoleDevicePutText instead.


function HD44780ConsoleGetPosition(Console:PConsoleDevice; Position:LongWord; var X1,Y1,X2,Y2:LongWord):LongWord;
Description: Implementation of ConsoleDeviceGetPosition API for HD44780
Note Not intended to be called directly by applications, use ConsoleDeviceGetPosition instead.


HD44780 helper functions

function HD44780WriteChar(Console:PHD44780Console; Ch:Char):LongWord;
Description: Write character data to the HD44780 device
Note Caller must hold the Console lock


function HD44780WriteData(Console:PHD44780Console; Value:Byte):LongWord;
Description: Write command data to the HD44780 device
Note Caller must hold the Console lock


function HD44780PulseEnable(Console:PHD44780Console):LongWord;
Description: Pulse the clock enable line off, on, off to send a command
Note Caller must hold the Console lock


function HD44780CursorHome(Console:PHD44780Console):LongWord;
Description: Return the cursor to the top left corner
Note Caller must hold the Console lock


function HD44780CursorBlink(Console:PHD44780Console; Blink:Boolean):LongWord;
Description: Set the cursor blinking to on or off
Note Caller must hold the Console lock


function HD44780CursorVisible(Console:PHD44780Console; Visible:Boolean):LongWord;
Description: Set the cursor to visible or not visible
Note Caller must hold the Console lock


function HD44780CursorPosition(Console:PHD44780Console; Row,Col:Byte):LongWord;
Description: Set the cursor position to Row, Col
Note Caller must hold the Console lock


function HD44780DisplayEnabled(Console:PHD44780Console; Enabled:Boolean):LongWord;
Description: Set the display state to on or off
Note Caller must hold the Console lock


function HD44780AddCharacter(Console:PHD44780Console; Location:Byte; Character:THD44780Character):LongWord;
Description: Add a custom character to the display
Note Caller must hold the Console lock


Return to Unit Reference