COSA
An Object-Oriented Platform for Arduino Programming
HD44780::SR3W Class Reference

#include <HD44780.hh>

Inheritance diagram for HD44780::SR3W:
Inheritance graph
Collaboration diagram for HD44780::SR3W:
Collaboration graph

Classes

union  port_t
 

Public Member Functions

 SR3W (Board::DigitalPin sda=Board::D7, Board::DigitalPin scl=Board::D6, Board::DigitalPin en=Board::D5)
 
virtual bool setup ()
 
virtual void write4b (uint8_t data)
 
virtual void write8b (uint8_t data)
 
virtual void set_mode (uint8_t flag)
 
virtual void set_backlight (uint8_t flag)
 
virtual void write8n (const void *buf, size_t size)
 

Protected Attributes

port_t m_port
 Port setting. More...
 
OutputPin m_sda
 Serial data output. More...
 
OutputPin m_scl
 Serial clock. More...
 
OutputPin m_en
 Starts data read/write. More...
 

Static Protected Attributes

static const uint16_t SHORT_EXEC_TIME = 20
 

Detailed Description

HD44780 (LCD-II) Dot Matix Liquid Crystal Display Controller/Driver Shift Register 3-Wire Port (SR3W), 74HC595/74HC164 (SR[pin]), with digital output pins.

Circuit

74HC595 (VCC)
+----U----+ |
(LCD D5)------------1-|Q1 VCC|-16-+
(LCD D6)------------2-|Q2 Q0|-15-----------(LCD D4)
(LCD D7)------------3-|Q3 SER|-14-----------(SDA/D7)
(LCD RS)------------4-|Q4 /OE|-13-----------(GND)
(LCD BT)------------5-|Q5 RCLK|-12-----------(EN/D5)
6-|Q6 SCLK|-11-----------(SCL/D6)
7-|Q7 /MR|-10-----------(VCC)
+-8-|GND Q6'|--9
| +---------+
| 0.1uF
(GND)-----||----(VCC)
(LCD EN)---------------------------------------(EN/D5)
(LCD RW)---------------------------------------(GND)
(LCD K)----------------------------------------(GND)
(LCD A)-----------------[330]------------------(VCC)

Alternative circuit with 74HC164.

74HC164 (VCC)
+----U----+ |
(SDA/D7)----------+-1-|DSA VCC|-14-+
+-2-|DSB Q7|-13
(LCD D4)------------3-|Q0 Q6|-12
(LCD D5)------------4-|Q1 Q5|-11--------(LCD BT)
(LCD D6)------------5-|Q2 Q4|-10--------(LCD RS)
(LCD D7)------------6-|Q3 /MR|--9-----------(VCC)
+-7-|GND CP|--8--------(SCL/D6)
| +---------+
| 0.1uF
(GND)-----||----(VCC)
(LCD EN)---------------------------------------(EN/D5)
(LCD RW)---------------------------------------(GND)
(LCD K)----------------------------------------(GND)
(LCD A)-----------------[330]------------------(VCC)

Performance

The LSB of the shift register is used to allow reduction of number of shift operations (i.e. 6-bit shift).

Definition at line 483 of file HD44780.hh.

Constructor & Destructor Documentation

HD44780::SR3W::SR3W ( Board::DigitalPin  sda = Board::D7,
Board::DigitalPin  scl = Board::D6,
Board::DigitalPin  en = Board::D5 
)

Construct HD44780 3-wire serial port connected to given serial data, clock and enable pulse pin.

Parameters
[in]sdaserial data pin (Default D7, Tiny/D1)
[in]sclserial clock pin (Default D6, Tiny/D2)
[in]enenable pulse (Default D5, Tiny/D3)

Definition at line 23 of file HD44780_SR3W.cpp.

Member Function Documentation

void HD44780::SR3W::set_backlight ( uint8_t  flag)
virtual

Set backlight on/off using bt pin.

Parameters
[in]flag.

Implements HD44780::IO.

Definition at line 85 of file HD44780_SR3W.cpp.

void HD44780::SR3W::set_mode ( uint8_t  flag)
virtual

Set instruction/data mode using given rs pin; zero for instruction, non-zero for data mode.

Parameters
[in]flag.

Implements HD44780::IO.

Definition at line 79 of file HD44780_SR3W.cpp.

bool HD44780::SR3W::setup ( )
virtual

Initiate serial port. Returns false.

Returns
bool.

Implements HD44780::IO.

Definition at line 34 of file HD44780_SR3W.cpp.

void HD44780::SR3W::write4b ( uint8_t  data)
virtual

Write LSB nibble to display using serial port.

Parameters
[in]data(4b) to write.

Implements HD44780::IO.

Definition at line 40 of file HD44780_SR3W.cpp.

void HD44780::SR3W::write8b ( uint8_t  data)
virtual

Write byte (8bit) to display.

Parameters
[in]data(8b) to write.

Reimplemented from HD44780::IO.

Definition at line 69 of file HD44780_SR3W.cpp.

void HD44780::IO::write8n ( const void *  buf,
size_t  size 
)
virtualinherited

Write character buffer to display.

Parameters
[in]bufpointer to buffer.
[in]sizenumber of bytes in buffer.

Reimplemented in ERM1602_5, Adafruit_I2C_LCD_Backpack, DFRobot_IIC_LCD_Module, MJKDZ_LCD_Module, and SainSmart_LCD2004.

Definition at line 31 of file HD44780_IO.cpp.

Member Data Documentation

OutputPin HD44780::SR3W::m_en
protected

Starts data read/write.

Definition at line 564 of file HD44780.hh.

port_t HD44780::SR3W::m_port
protected

Port setting.

Definition at line 561 of file HD44780.hh.

OutputPin HD44780::SR3W::m_scl
protected

Serial clock.

Definition at line 563 of file HD44780.hh.

OutputPin HD44780::SR3W::m_sda
protected

Serial data output.

Definition at line 562 of file HD44780.hh.

const uint16_t HD44780::SR3W::SHORT_EXEC_TIME = 20
staticprotected

Execution time delay (us).

Definition at line 540 of file HD44780.hh.


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