Hd44780 Class

Definition

Supports LCD character displays compatible with the HD44780 LCD controller/driver. Also supports serial interface adapters such as the MCP23008.

public class Hd44780 : IDisposable
public class Hd44780 : IDisposable, Iot.Device.CharacterLcd.ICharacterLcd
type Hd44780 = class
    interface IDisposable
type Hd44780 = class
    interface ICharacterLcd
    interface IDisposable
Public Class Hd44780
Implements IDisposable
Public Class Hd44780
Implements ICharacterLcd, IDisposable
Inheritance
Hd44780
Derived
Implements

Remarks

The Hitatchi HD44780 was released in 1987 and set the standard for LCD controllers. Hitatchi does not make this chipset anymore, but most character LCD drivers are intended to be fully compatible with this chipset. Some examples: Sunplus SPLC780D, Sitronix ST7066U, Samsung KS0066U, Aiptek AIP31066, and many more.

Some compatible chips extend the HD44780 with addtional pins and features. They are still fully compatible. The ST7036 is one example.

This implementation was drawn from numerous datasheets and libraries such as Adafruit_Python_CharLCD.

Constructors

Hd44780(Size, LcdInterface)

Initializes a new HD44780 LCD controller.

Hd44780(Size, LcdInterface)

Initializes a new HD44780 LCD controller.

Fields

_interface
_lcdInterface

LCD interface used by the device

_rowOffsets

Offsets of the rows

ClearDisplayCommand

Command which can be used to clear the display

ReturnHomeCommand

Command which can be used to return (cursor) home

SetCGRamAddressCommand

Command which can be used to set CG RAM address

SetDDRamAddressCommand

Command which can be used to set DD RAM address

Properties

AutoShift

When enabled the display will shift rather than the cursor.

BacklightOn

Enable/disable the backlight. (Will always return false if no backlight pin was provided.)

BlinkingCursorVisible

Enable/disable the blinking cursor.

DisplayOn

Enable/disable the display.

Increment

Gets/sets whether the cursor location increments (true) or decrements (false).

NumberOfCustomCharactersSupported

Returns the number of custom characters for this display. A custom character is one that can be user-defined and assigned to a slot using CreateCustomCharacter(Int32, ReadOnlySpan<Byte>)

Size

Logical size, in characters, of the LCD.

UnderlineCursorVisible

Enable/disable the underline cursor.

Methods

Clear()

Clears the LCD, returning the cursor to home and unshifting if shifted. Will also set to Increment.

CreateCustomCharacter(Byte, Byte[])
CreateCustomCharacter(Byte, ReadOnlySpan<Byte>)

Fill one of the 8 CGRAM locations (character codes 0 - 7) with custom characters.

CreateCustomCharacter(Int32, Byte[])

Fill one of the 8 CGRAM locations (character codes 0 - 7) with custom characters. See CreateCustomCharacter(Int32, ReadOnlySpan<Byte>) for details.

CreateCustomCharacter(Int32, ReadOnlySpan<Byte>)

Fill one of the 8 CGRAM locations (character codes 0 - 7) with custom characters.

Dispose()

Releases unmanaged resources used by Hd44780 and optionally release managed resources

Dispose(Boolean)

Releases unmanaged resources used by Hd44780 and optionally release managed resources

GetTwoLineMode(Int32)

Determines if the device should use two line mode

Home()

Moves the cursor to the first line and first column, unshifting if shifted.

InitializeRowOffsets(Int32)

Initializes row offsets

SendCommand(Byte)

Sends command to the device

SendCommandAndWait(Byte)

The initialization sequence and some other complex commands should be sent with delays, or the display may behave unexpectedly. It may show random, blinking characters or display text very faintly only.

SendCommands(ReadOnlySpan<Byte>)

Send commands to the device

SendData(Byte)

Sends byte to the device

SendData(ReadOnlySpan<Byte>)

Sends data to the device

SendData(ReadOnlySpan<Char>)

Sends data to the device

SetCursorPosition(Int32, Int32)

Moves the cursor to an explicit column and row position.

ShiftCursorLeft()

Move the cursor left one position.

ShiftCursorRight()

Move the cursor right one position.

ShiftDisplayLeft()

Move the display left one position.

ShiftDisplayRight()

Move the display right one position.

WaitForNotBusy(Int32)

Wait for the device to not be busy.

Write(Char[])

Write a raw byte stream to the display. Used if character translation already took place

Write(ReadOnlySpan<Byte>)

Write a raw byte stream to the display. Used if character translation already took place

Write(ReadOnlySpan<Char>)

Write a raw byte stream to the display. Used if character translation already took place

Write(String)

Write text to display.

Extension Methods

CreateCustomCharacter(ICharacterLcd, Byte, Byte, Byte, Byte, Byte, Byte, Byte, Byte, Byte)

Creates a custom character for standard displays with 8-pixel-per-row characters. See CreateCustomCharacter(Int32, ReadOnlySpan<Byte>) for details.

Applies to