Arduino-LCD
LCD library for Arduino
PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN > Class Template Reference

#include <PCD8544.h>

Inheritance diagram for PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >:
Inheritance graph
Collaboration diagram for PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >:
Collaboration graph

Public Member Functions

 PCD8544 (const uint8_t *font=NULL)
 
virtual bool begin ()
 
virtual bool end ()
 
virtual void display_contrast (uint8_t level)
 
virtual void display_on ()
 
virtual void display_off ()
 
virtual void display_normal ()
 
virtual void display_inverse ()
 
virtual void display_clear ()
 
virtual void cursor_set (uint8_t x, uint8_t y)
 
virtual size_t write (uint8_t c)
 
virtual void backlight_on ()
 
virtual void backlight_off ()
 
virtual void cursor_blink_on ()
 
virtual void cursor_blink_off ()
 
void cursor_get (uint8_t &x, uint8_t &y) const
 
virtual void cursor_home ()
 
virtual void cursor_update ()
 
uint8_t tab_step () const
 
void tab_step (uint8_t step)
 
uint8_t text_mode () const
 
void text_normal_mode ()
 
void text_inverted_mode ()
 

Static Public Attributes

static const uint8_t FONT_WIDTH = 6
 
static const uint8_t FONT_HEIGHT = 8
 
static const uint8_t WIDTH = 84 / FONT_WIDTH
 
static const uint8_t HEIGHT = 48 / FONT_HEIGHT
 

Protected Types

enum  {
  NOP = 0x00, SET_FUNC = 0x20, BASIC_INST = 0x00, EXTENDED_INST = 0x01,
  HORIZONTAL_ADDR = 0x00, VERTICAL_ADDR = 0x02, POWER_UP_MODE = 0x00, POWER_DOWN_MODE = 0x04,
  DISPLAY_CNTL = 0x08, DISPLAY_OFF = 0x00, DISPLAY_ON = 0x01, NORMAL_MODE = 0x04,
  INVERSE_MODE = 0x05, SET_Y_ADDR = 0x40, Y_ADDR_MASK = 0x07, SET_X_ADDR = 0x80,
  X_ADDR_MASK = 0x7f, SET_TEMP_COEFF = 0x04, SET_BIAS_SYS = 0x10, SET_VOP = 0x80,
  VOP_MASK = 0x7f, SCRIPT_END = 0xff
}
 

Protected Member Functions

void write_data (uint8_t value)
 
void write_data (uint8_t value, size_t count)
 
void write_command (uint8_t value)
 
void write_command_P (const uint8_t *buf, size_t count)
 

Protected Attributes

GPIO< SCE_PIN > m_sce
 
GPIO< DC_PIN > m_dc
 
SRPO< MSBFIRST, SDIN_PIN, SCLK_PIN > m_srpo
 
const uint8_t * m_font
 
uint8_t m_x
 Cursor position x. More...
 
uint8_t m_y
 Cursor position y. More...
 
uint8_t m_tab
 Tab step. More...
 
uint8_t m_mode
 Text mode. More...
 

Static Protected Attributes

static const uint8_t BACKGROUND = 0x00
 

Detailed Description

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
class PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >

Device driver for PCD8544 48x84 pixels matrix LCD controller/driver.

Parameters
[in]SCE_PINscreen chip enable pin.
[in]DC_PINdata/command select pin.
[in]SDIN_PINscreen data pin.
[in]SCLK_PINscreen clock pin.

Circuit

PCD8544 is a low voltage device (3V3) and signals require level shifter (74HC4050 or 10K resistor).

+------------+
(RST)--------[ > ]--1-|RST |
(D5)---------[ > ]--2-|SCE |
(D4)---------[ > ]--3-|DC |
(D3)---------[ > ]--4-|SDIN |
(D2)---------[ > ]--5-|SCLK |
(3V3)---------------6-|VCC |
(GND)--------[220]--7-|LED |
(GND)---------------8-|GND |
+------------+

References

  1. Product Specification, Philips Semiconductors, 1999 Apr 12. https://www.sparkfun.com/datasheets/LCD/Monochrome/Nokia5110.pdf

Definition at line 62 of file PCD8544.h.

Member Enumeration Documentation

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
anonymous enum
protected

Instruction set (table 1, pp. 14).

Enumerator
NOP 

No operation.

SET_FUNC 

Set function.

BASIC_INST 

Basic instruction set.

EXTENDED_INST 

Extended instruction set control.

HORIZONTAL_ADDR 

Horizontal addressing.

VERTICAL_ADDR 

Vertical addressing.

POWER_UP_MODE 

Power up mode.

POWER_DOWN_MODE 

Power down mode.

DISPLAY_CNTL 

Display control.

DISPLAY_OFF 

Turn display off.

DISPLAY_ON 

Turn display on.

NORMAL_MODE 

Normal display mode.

INVERSE_MODE 

Inverse display mode.

SET_Y_ADDR 

Sets Y-address of RAM (0..5).

Y_ADDR_MASK 

Mask Y-address.

SET_X_ADDR 

Sets X-address of RAM (0..83).

X_ADDR_MASK 

Mask X-addres.

SET_TEMP_COEFF 

Set temperature coefficient (0..3).

SET_BIAS_SYS 

Set Bias System (0..7).

SET_VOP 

Write Vop to register (0..127).

VOP_MASK 

Mask Vop.

SCRIPT_END 

Init script end.

Definition at line 355 of file PCD8544.h.

Constructor & Destructor Documentation

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::PCD8544 ( const uint8_t *  font = NULL)
inline

Construct display device driver and initiate pins. The parameter should a 5x7 font in program memory or NULL for the default font.

Parameters
[in]fontin program memory (Default NULL).

Definition at line 76 of file PCD8544.h.

Member Function Documentation

virtual void LCD::Device::backlight_off ( )
inlinevirtualinherited

Turn display backlight off.

Reimplemented in HD44780, and LCD4884.

Definition at line 70 of file LCD.h.

virtual void LCD::Device::backlight_on ( )
inlinevirtualinherited

Turn display backlight on.

Reimplemented in HD44780, and LCD4884.

Definition at line 64 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual bool PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::begin ( )
inlinevirtual

Start interaction with display.

Returns
true(1) if successful otherwise false(0)

Implements LCD::Device.

Reimplemented in LCD4884.

Definition at line 187 of file PCD8544.h.

virtual void LCD::Device::cursor_blink_off ( )
inlinevirtualinherited

Turn cursor blink off.

Reimplemented in HD44780.

Definition at line 119 of file LCD.h.

virtual void LCD::Device::cursor_blink_on ( )
inlinevirtualinherited

Turn cursor blink on.

Reimplemented in HD44780.

Definition at line 113 of file LCD.h.

void LCD::Device::cursor_get ( uint8_t &  x,
uint8_t &  y 
) const
inlineinherited

Get current cursor position.

Parameters
[out]x.
[out]y.

Definition at line 126 of file LCD.h.

virtual void LCD::Device::cursor_home ( )
inlinevirtualinherited

Set cursor to home position (0, 0).

Reimplemented in HD44780.

Definition at line 145 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual void PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::cursor_set ( uint8_t  x,
uint8_t  y 
)
inlinevirtual

Set cursor to given position.

Parameters
[in]xpixel position (0..WIDTH-1).
[in]yline position (0..LINES-1).

Implements LCD::Device.

Definition at line 286 of file PCD8544.h.

virtual void LCD::Device::cursor_update ( )
inlinevirtualinherited

Call frequently to allow cursor blink.

Definition at line 154 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual void PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::display_clear ( )
inlinevirtual

Clear display and move cursor to home.

Implements LCD::Device.

Definition at line 273 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual void PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::display_contrast ( uint8_t  level)
inlinevirtual

Set display contrast (0..127).

Parameters
[in]contrastlevel.

Reimplemented from LCD::Device.

Definition at line 226 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual void PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::display_inverse ( )
inlinevirtual

Display inverse mode.

Reimplemented from LCD::Device.

Definition at line 264 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual void PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::display_normal ( )
inlinevirtual

Display normal mode.

Reimplemented from LCD::Device.

Definition at line 255 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual void PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::display_off ( )
inlinevirtual

Turn display off.

Implements LCD::Device.

Definition at line 246 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual void PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::display_on ( )
inlinevirtual

Turn display on.

Implements LCD::Device.

Definition at line 237 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual bool PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::end ( )
inlinevirtual

Stop interaction with device and power down.

Returns
true(1) if successful otherwise false(0)

Reimplemented from LCD::Device.

Definition at line 213 of file PCD8544.h.

uint8_t LCD::Device::tab_step ( ) const
inlineinherited

Get tab step.

Returns
tab step.

Definition at line 160 of file LCD.h.

void LCD::Device::tab_step ( uint8_t  step)
inlineinherited

Set tab step to given value.

Parameters
[in]steptab.

Definition at line 170 of file LCD.h.

void LCD::Device::text_inverted_mode ( )
inlineinherited

Set inverted text mode.

Definition at line 197 of file LCD.h.

uint8_t LCD::Device::text_mode ( ) const
inlineinherited

Get text mode. Return 0x00 for normal mode, 0xff inverted mode.

Definition at line 179 of file LCD.h.

void LCD::Device::text_normal_mode ( )
inlineinherited

Set normal text mode.

Definition at line 188 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual size_t PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::write ( uint8_t  c)
inlinevirtual

Write character to display. Handles carriage-return, line-feed, backspace, alert, horizontal tab and form-feed. Returns number of characters(1) or zero(0) on error.

Parameters
[in]ccharacter to write.
Returns
number of characters written(1) or zero(0) for error.

Definition at line 304 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
void PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::write_command ( uint8_t  value)
inlineprotected

Definition at line 410 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
void PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::write_command_P ( const uint8_t *  buf,
size_t  count 
)
inlineprotected

Definition at line 419 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
void PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::write_data ( uint8_t  value)
inlineprotected

Definition at line 395 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
void PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::write_data ( uint8_t  value,
size_t  count 
)
inlineprotected

Definition at line 402 of file PCD8544.h.

Member Data Documentation

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
const uint8_t PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::BACKGROUND = 0x00
staticprotected

Background pattern.

Definition at line 381 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
const uint8_t PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::FONT_HEIGHT = 8
static

Definition at line 66 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
const uint8_t PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::FONT_WIDTH = 6
static

Display size.

Definition at line 65 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
const uint8_t PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::HEIGHT = 48 / FONT_HEIGHT
static

Definition at line 68 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
GPIO<DC_PIN> PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::m_dc
protected

Data/control select pin.

Definition at line 387 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
const uint8_t* PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::m_font
protected

Font (5x7), program memory pointer.

Definition at line 393 of file PCD8544.h.

uint8_t LCD::Device::m_mode
protectedinherited

Text mode.

Definition at line 207 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
GPIO<SCE_PIN> PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::m_sce
protected

Screen chip enable pin.

Definition at line 384 of file PCD8544.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
SRPO<MSBFIRST, SDIN_PIN, SCLK_PIN> PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::m_srpo
protected

Screen data input and clock pins; Serial Ouput.

Definition at line 390 of file PCD8544.h.

uint8_t LCD::Device::m_tab
protectedinherited

Tab step.

Definition at line 206 of file LCD.h.

uint8_t LCD::Device::m_x
protectedinherited

Cursor position x.

Definition at line 204 of file LCD.h.

uint8_t LCD::Device::m_y
protectedinherited

Cursor position y.

Definition at line 205 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t DC_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
const uint8_t PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >::WIDTH = 84 / FONT_WIDTH
static

Definition at line 67 of file PCD8544.h.


The documentation for this class was generated from the following file: