Remarks

CharacterDisplay
Status
Source code GitHub
NuGet package

The CharacterDisplay class represents a multiline liquid crystal character display.

These displays are commonly found in 16x2 and 20x4 character by row configurations. Each character is represented using a grid of 5x7 pixels.

The current driver implementation uses 4 or 8 GPIO pins. It's common to find controller boards with this displays that provide I2C, SPI, or serial control. These will be supported in a future update.

Code Example

The following example shows how to print an incrementing counter every second on the LCD display:

class CharacterDisplayApp : App<F7Micro, CharacterDisplayApp>
{
    CharacterDisplay display;

    public CharacterDisplayApp()
    {
        display = new CharacterDisplay(
            Device,
            pinRS: Device.Pins.D05,
            pinE:  Device.Pins.D07,
            pinD4: Device.Pins.D08,
            pinD5: Device.Pins.D09,
            pinD6: Device.Pins.D10,
            pinD7: Device.Pins.D11,
            rows: 2, columns: 16    // Adjust dimensions to fit your display
            );

        int count = 0;
        display.WriteLine("CharacterDisplay", 0);

        while (true)
        {
            display.WriteLine($"Count is : {count++}", 1);
            System.Threading.Thread.Sleep(1000);
        }
    }
}

Sample projects available on GitHub

Wiring Example

Characteristic Locus
Inheritance System.Object > CharacterDisplay
Namespace Meadow.Foundation.Displays.Lcd
Assembly CharacterDisplay.dll

Syntax

public class CharacterDisplay : ITextDisplay

Constructors

View Source

CharacterDisplay(IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, UInt16, UInt16)

Declaration
public CharacterDisplay(IDigitalOutputPort portRS, IDigitalOutputPort portE, IDigitalOutputPort portD4, IDigitalOutputPort portD5, IDigitalOutputPort portD6, IDigitalOutputPort portD7, ushort rows = 4, ushort columns = 20)

Parameters

Type Name Description
IDigitalOutputPort portRS
IDigitalOutputPort portE
IDigitalOutputPort portD4
IDigitalOutputPort portD5
IDigitalOutputPort portD6
IDigitalOutputPort portD7
System.UInt16 rows
System.UInt16 columns
View Source

CharacterDisplay(IIODevice, IPin, IPin, IPin, IPin, IPin, IPin, UInt16, UInt16)

Declaration
public CharacterDisplay(IIODevice device, IPin pinRS, IPin pinE, IPin pinD4, IPin pinD5, IPin pinD6, IPin pinD7, ushort rows = 4, ushort columns = 20)

Parameters

Type Name Description
IIODevice device
IPin pinRS
IPin pinE
IPin pinD4
IPin pinD5
IPin pinD6
IPin pinD7
System.UInt16 rows
System.UInt16 columns

Fields

View Source

LCD_D4

Declaration
protected IDigitalOutputPort LCD_D4

Field Value

Type Description
IDigitalOutputPort
View Source

LCD_D5

Declaration
protected IDigitalOutputPort LCD_D5

Field Value

Type Description
IDigitalOutputPort
View Source

LCD_D6

Declaration
protected IDigitalOutputPort LCD_D6

Field Value

Type Description
IDigitalOutputPort
View Source

LCD_D7

Declaration
protected IDigitalOutputPort LCD_D7

Field Value

Type Description
IDigitalOutputPort
View Source

LCD_E

Declaration
protected IDigitalOutputPort LCD_E

Field Value

Type Description
IDigitalOutputPort
View Source

LCD_RS

Declaration
protected IDigitalOutputPort LCD_RS

Field Value

Type Description
IDigitalOutputPort
View Source

LED_ON

Declaration
protected IDigitalOutputPort LED_ON

Field Value

Type Description
IDigitalOutputPort

Properties

View Source

DisplayConfig

Declaration
public TextDisplayConfig DisplayConfig { get; protected set; }

Property Value

Type Description
TextDisplayConfig

Methods

View Source

Clear()

Declaration
public void Clear()
View Source

ClearLine(Byte)

Declaration
public void ClearLine(byte lineNumber)

Parameters

Type Name Description
System.Byte lineNumber
View Source

SaveCustomCharacter(Byte[], Byte)

Declaration
public void SaveCustomCharacter(byte[] characterMap, byte address)

Parameters

Type Name Description
System.Byte[] characterMap
System.Byte address
View Source

SetBrightness(Single)

Declaration
public void SetBrightness(float brightness = 0.75F)

Parameters

Type Name Description
System.Single brightness
View Source

SetCursorPosition(Byte, Byte)

Declaration
public void SetCursorPosition(byte column, byte line)

Parameters

Type Name Description
System.Byte column
System.Byte line
View Source

Write(String)

Declaration
public void Write(string text)

Parameters

Type Name Description
System.String text
View Source

WriteLine(String, Byte)

Declaration
public void WriteLine(string text, byte lineNumber)

Parameters

Type Name Description
System.String text
System.Byte lineNumber