Remarks

Pcd8544
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.Pcd8544

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

MicroGraphics graphics;

public override Task Initialize()
{
    Console.WriteLine("Initializing...");

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

    var 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 MicroGraphics(display);

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear(true);
    graphics.CurrentFont = new Font8x12();
    graphics.DrawText(0, 0, "PCD8544");
    graphics.DrawRectangle(5, 14, 30, 10, true);

    graphics.Show();

    return base.Run();
}

Sample project(s) 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
Implements IGraphicsDisplay
Namespace Meadow.Foundation.Displays
Assembly Pcd8544.dll

Syntax

public class Pcd8544 : object, IGraphicsDisplay

Constructors

Pcd8544(IMeadowDevice, ISpiBus, IPin, IPin, IPin)

Create a Pcd8544 object

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

Parameters

Type Name Description
IMeadowDevice device

Meadow device

ISpiBus spiBus

SPI bus connected to display

IPin chipSelectPin

Chip select pin

IPin dcPin

Data command pin

IPin resetPin

Reset pin

Pcd8544(ISpiBus, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort)

Create a new Pcd8544 display object

Declaration
public Pcd8544(ISpiBus spiBus, IDigitalOutputPort chipSelectPort, IDigitalOutputPort dataCommandPort, IDigitalOutputPort resetPort)

Parameters

Type Name Description
ISpiBus spiBus

SPI bus connected to display

IDigitalOutputPort chipSelectPort

Chip select output port

IDigitalOutputPort dataCommandPort

Data command output port

IDigitalOutputPort resetPort

Reset output port

Fields

chipSelectPort

Declaration
protected IDigitalOutputPort chipSelectPort

Field Value

Type Description
IDigitalOutputPort

commandBuffer

Buffer to hold internal command data to be sent over the SPI bus

Declaration
protected Memory<byte> commandBuffer

Field Value

Type Description
Memory<System.Byte>

dataCommandPort

Declaration
protected IDigitalOutputPort dataCommandPort

Field Value

Type Description
IDigitalOutputPort

DEFAULT_SPEED

Default SPI bus speed

Declaration
public static Frequency DEFAULT_SPEED

Field Value

Type Description
Frequency

imageBuffer

Buffer to hold display data

Declaration
protected Buffer1bpp imageBuffer

Field Value

Type Description
Buffer1bpp

resetPort

Declaration
protected IDigitalOutputPort resetPort

Field Value

Type Description
IDigitalOutputPort

spiPeripheral

Declaration
protected ISpiPeripheral spiPeripheral

Field Value

Type Description
ISpiPeripheral

Properties

ColorMode

Display color mode

Declaration
public ColorType ColorMode { get; }

Property Value

Type Description
ColorType

Height

Height of display in pixels

Declaration
public int Height { get; }

Property Value

Type Description
System.Int32

IsDisplayInverted

Is the display inverted

Declaration
public bool IsDisplayInverted { get; }

Property Value

Type Description
System.Boolean

PixelBuffer

The buffer the holds the pixel data for the display

Declaration
public IPixelBuffer PixelBuffer { get; }

Property Value

Type Description
IPixelBuffer

Width

Width of display in pixels

Declaration
public int Width { get; }

Property Value

Type Description
System.Int32

Methods

Clear(Boolean)

Clear the display

Declaration
public 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

DrawPixel(Int32, Int32, Color)

Draw pixel at location

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

Parameters

Type Name Description
System.Int32 x

x position in pixels

System.Int32 y

y position in pixels

Color color

any value other than black will make the pixel visible

DrawPixel(Int32, Int32, Boolean)

Draw pixel at location

Declaration
public void DrawPixel(int x, int y, bool enabled)

Parameters

Type Name Description
System.Int32 x

x position in pixels

System.Int32 y

y position in pixels

System.Boolean enabled

True = turn on pixel, false = turn off pixel

Fill(Color, Boolean)

Declaration
public void Fill(Color clearColor, bool updateDisplay = false)

Parameters

Type Name Description
Color clearColor
System.Boolean updateDisplay

Fill(Int32, Int32, Int32, Int32, Color)

Declaration
public void Fill(int x, int y, int width, int height, Color color)

Parameters

Type Name Description
System.Int32 x
System.Int32 y
System.Int32 width
System.Int32 height
Color color

InvertDisplay(Boolean)

Invert the entire display

Declaration
public void InvertDisplay(bool inverse)

Parameters

Type Name Description
System.Boolean inverse

Invert if true, normal if false

InvertPixel(Int32, Int32)

Invert pixel at a location

Declaration
public void InvertPixel(int x, int y)

Parameters

Type Name Description
System.Int32 x

x position in pixels

System.Int32 y

y position in pixels

Show()

Declaration
public void Show()

Show(Int32, Int32, Int32, Int32)

Declaration
public void Show(int left, int top, int right, int bottom)

Parameters

Type Name Description
System.Int32 left
System.Int32 top
System.Int32 right
System.Int32 bottom

WriteBuffer(Int32, Int32, IPixelBuffer)

Declaration
public void WriteBuffer(int x, int y, IPixelBuffer displayBuffer)

Parameters

Type Name Description
System.Int32 x
System.Int32 y
IPixelBuffer displayBuffer