Remarks

PCD8544
Status
Source code GitHub
NuGet package

The PCD8544 display, also known as a Nokia 5110 LCD, is a single color 84x84 LCD display. Data is sent to the display via SPI. The also typically also include an led backlight controlled via a single pin.

These displays have excellent visibility in daylight, even without the backlight, making them a good choice for builds with low-power restrictions and require visibility is bright light or daylight.

Purchasing

Code Example

public class MeadowApp : App<F7Micro, MeadowApp>
{
    Pcd8544 display;
    GraphicsLibrary graphics;

    public MeadowApp()
    {
        Console.WriteLine("Initializing...");

        var config = new Meadow.Hardware.SpiClockConfiguration(
            Pcd8544.DEFAULT_SPEED, 
            Meadow.Hardware.SpiClockConfiguration.Mode.Mode0);

        display = new Pcd8544
        (
            device: Device,
            spiBus: Device.CreateSpiBus(
                Device.Pins.SCK, 
                Device.Pins.MOSI, 
                Device.Pins.MISO, 
                config),
            chipSelectPin: Device.Pins.D01,
            dcPin: Device.Pins.D00,
            resetPin: Device.Pins.D02
        );

        graphics = new GraphicsLibrary(display);
        graphics.Rotation = GraphicsLibrary.RotationType._180Degrees;

        TestPcd8544();
    }

    void TestPcd8544() 
    {
        Console.WriteLine("TestPcd8544...");

        // Drawing with Display Graphics Library
        graphics.Clear(true);
        graphics.CurrentFont = new Font8x12();
        graphics.DrawText(0, 0, "PCD8544");
        graphics.DrawRectangle(5, 14, 30, 10, true);

        graphics.Show();
    }
}

Sample projects available on GitHub

Wiring Example

To wire a PCD8544 to your Meadow board, connect the following:

PCD8544 Meadow Pin
GND GND
LIGHT GND
VCC 3V3
CLK SCK
DIN MOSI
DC D00
CE D01
RST D02

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

Syntax

public class Pcd8544 : DisplayBase

Constructors

View Source

Pcd8544(IIODevice, ISpiBus, IPin, IPin, IPin)

Declaration
public Pcd8544(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin)

Parameters

Type Name Description
IIODevice device
ISpiBus spiBus
IPin chipSelectPin
IPin dcPin
IPin resetPin

Fields

View Source

_invertDisplay

Declaration
protected bool _invertDisplay

Field Value

Type Description
System.Boolean
View Source

chipSelectPort

Declaration
protected IDigitalOutputPort chipSelectPort

Field Value

Type Description
IDigitalOutputPort
View Source

currentPen

Declaration
protected Color currentPen

Field Value

Type Description
Color
View Source

dataCommandPort

Declaration
protected IDigitalOutputPort dataCommandPort

Field Value

Type Description
IDigitalOutputPort
View Source

DEFAULT_SPEED

Declaration
public static int DEFAULT_SPEED

Field Value

Type Description
System.Int32
View Source

resetPort

Declaration
protected IDigitalOutputPort resetPort

Field Value

Type Description
IDigitalOutputPort
View Source

spi

Declaration
protected SpiBus spi

Field Value

Type Description
SpiBus
View Source

spiBuffer

Declaration
protected byte[] spiBuffer

Field Value

Type Description
System.Byte[]
View Source

spiDisplay

Declaration
protected ISpiPeripheral spiDisplay

Field Value

Type Description
ISpiPeripheral
View Source

spiReceive

Declaration
protected readonly byte[] spiReceive

Field Value

Type Description
System.Byte[]

Properties

View Source

ColorMode

Declaration
public override DisplayColorMode ColorMode { get; }

Property Value

Type Description
DisplayColorMode
View Source

Height

Declaration
public override uint Height { get; }

Property Value

Type Description
System.UInt32
View Source

InvertDisplay

Declaration
public bool InvertDisplay { get; set; }

Property Value

Type Description
System.Boolean
View Source

Width

Declaration
public override uint Width { get; }

Property Value

Type Description
System.UInt32

Methods

View Source

Clear(Boolean)

Clear the display

Declaration
public override void Clear(bool updateDisplay = false)

Parameters

Type Name Description
System.Boolean updateDisplay

If true, it will force a display update

Remarks

Clears the internal memory buffer

View Source

DrawBitmap(Int32, Int32, Int32, Int32, Byte[], BitmapMode)

Copy a bitmap to the display.

Declaration
public override void DrawBitmap(int x, int y, int width, int height, byte[] bitmap, BitmapMode bitmapMode)

Parameters

Type Name Description
System.Int32 x

Abscissa of the top left corner of the bitmap.

System.Int32 y

Ordinate of the top left corner of the bitmap.

System.Int32 width

Width of the bitmap in bytes.

System.Int32 height

Height of the bitmap in bytes.

System.Byte[] bitmap

Bitmap to transfer

BitmapMode bitmapMode

How should the bitmap be transferred to the display?

Remarks

Currently, this method only supports copying the bitmap over the contents of the display buffer.

View Source

DrawBitmap(Int32, Int32, Int32, Int32, Byte[], Color)

Declaration
public override void DrawBitmap(int x, int y, int width, int height, byte[] bitmap, Color color)

Parameters

Type Name Description
System.Int32 x
System.Int32 y
System.Int32 width
System.Int32 height
System.Byte[] bitmap
Color color
View Source

DrawPixel(Int32, Int32)

Coordinates start with index 0

Declaration
public override void DrawPixel(int x, int y)

Parameters

Type Name Description
System.Int32 x

Abscissa of the pixel to the set / reset.

System.Int32 y

Ordinate of the pixel to the set / reset.

View Source

DrawPixel(Int32, Int32, Color)

Coordinates start with index 0

Declaration
public override void DrawPixel(int x, int y, Color color)

Parameters

Type Name Description
System.Int32 x

Abscissa of the pixel to the set / reset.

System.Int32 y

Ordinate of the pixel to the set / reset.

Color color

any value other than black will make the pixel visible

View Source

DrawPixel(Int32, Int32, Boolean)

Coordinates start with index 0

Declaration
public override void DrawPixel(int x, int y, bool colored)

Parameters

Type Name Description
System.Int32 x

Abscissa of the pixel to the set / reset.

System.Int32 y

Ordinate of the pixel to the set / reset.

System.Boolean colored

True = turn on pixel, false = turn off pixel

View Source

SetPenColor(Color)

Declaration
public override void SetPenColor(Color pen)

Parameters

Type Name Description
Color pen
View Source

Show()

Declaration
public override void Show()