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
CharacterDisplay(IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, Byte, Byte)
Declaration
public CharacterDisplay(IDigitalOutputPort portRS, IDigitalOutputPort portE, IDigitalOutputPort portD4, IDigitalOutputPort portD5, IDigitalOutputPort portD6, IDigitalOutputPort portD7, byte rows = 4, byte columns = 20)
Parameters
Type | Name | Description |
---|---|---|
IDigitalOutputPort | portRS | |
IDigitalOutputPort | portE | |
IDigitalOutputPort | portD4 | |
IDigitalOutputPort | portD5 | |
IDigitalOutputPort | portD6 | |
IDigitalOutputPort | portD7 | |
System.Byte | rows | |
System.Byte | columns |
CharacterDisplay(II2cBus, Byte, Byte, Byte)
Declaration
public CharacterDisplay(II2cBus i2cBus, byte address = 39, byte rows = 4, byte columns = 20)
Parameters
Type | Name | Description |
---|---|---|
II2cBus | i2cBus | |
System.Byte | address | |
System.Byte | rows | |
System.Byte | columns |
CharacterDisplay(IIODevice, IPin, IPin, IPin, IPin, IPin, IPin, IPin, Byte, Byte)
Declaration
public CharacterDisplay(IIODevice device, IPin pinV0, IPin pinRS, IPin pinE, IPin pinD4, IPin pinD5, IPin pinD6, IPin pinD7, byte rows = 4, byte columns = 20)
Parameters
Type | Name | Description |
---|---|---|
IIODevice | device | |
IPin | pinV0 | |
IPin | pinRS | |
IPin | pinE | |
IPin | pinD4 | |
IPin | pinD5 | |
IPin | pinD6 | |
IPin | pinD7 | |
System.Byte | rows | |
System.Byte | columns |
CharacterDisplay(IIODevice, IPin, IPin, IPin, IPin, IPin, IPin, Byte, Byte)
Declaration
public CharacterDisplay(IIODevice device, IPin pinRS, IPin pinE, IPin pinD4, IPin pinD5, IPin pinD6, IPin pinD7, byte rows = 4, byte columns = 20)
Parameters
Type | Name | Description |
---|---|---|
IIODevice | device | |
IPin | pinRS | |
IPin | pinE | |
IPin | pinD4 | |
IPin | pinD5 | |
IPin | pinD6 | |
IPin | pinD7 | |
System.Byte | rows | |
System.Byte | columns |
CharacterDisplay(IPwmPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, Byte, Byte)
Declaration
public CharacterDisplay(IPwmPort portV0, IDigitalOutputPort portRS, IDigitalOutputPort portE, IDigitalOutputPort portD4, IDigitalOutputPort portD5, IDigitalOutputPort portD6, IDigitalOutputPort portD7, byte rows = 4, byte columns = 20)
Parameters
Type | Name | Description |
---|---|---|
IPwmPort | portV0 | |
IDigitalOutputPort | portRS | |
IDigitalOutputPort | portE | |
IDigitalOutputPort | portD4 | |
IDigitalOutputPort | portD5 | |
IDigitalOutputPort | portD6 | |
IDigitalOutputPort | portD7 | |
System.Byte | rows | |
System.Byte | columns |
Fields
characterDisplay
Declaration
protected ICharacterDisplay characterDisplay
Field Value
Type | Description |
---|---|
ICharacterDisplay |
Properties
DisplayConfig
Declaration
public TextDisplayConfig DisplayConfig { get; }
Property Value
Type | Description |
---|---|
TextDisplayConfig |
Methods
ClearLine(Byte)
Declaration
public void ClearLine(byte lineNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | lineNumber |
ClearLines()
Declaration
public void ClearLines()
SaveCustomCharacter(Byte[], Byte)
Declaration
public void SaveCustomCharacter(byte[] characterMap, byte address)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | characterMap | |
System.Byte | address |
SetCursorPosition(Byte, Byte)
Declaration
public void SetCursorPosition(byte column, byte line)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | column | |
System.Byte | line |
Show()
Declaration
public void Show()
Write(String)
Declaration
public void Write(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text |
WriteLine(String, Byte, Boolean)
Declaration
public void WriteLine(string text, byte lineNumber, bool showCursor = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | |
System.Byte | lineNumber | |
System.Boolean | showCursor |