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

#include <HD44780.hh>

Inheritance diagram for HD44780::Port4b:
Inheritance graph
Collaboration diagram for HD44780::Port4b:
Collaboration graph

Public Member Functions

 Port4b (Board::DigitalPin d0=Board::D4, Board::DigitalPin d1=Board::D5, Board::DigitalPin d2=Board::D6, Board::DigitalPin d3=Board::D7, Board::DigitalPin rs=Board::D8, Board::DigitalPin en=Board::D9, Board::DigitalPin bt=Board::D10)
 
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

OutputPin m_d0
 Data pin; d0. More...
 
OutputPin m_d1
 Data pin; d1. More...
 
OutputPin m_d2
 Data pin; d2. More...
 
OutputPin m_d3
 Data pin; d3. More...
 
OutputPin m_rs
 Register select (0/instruction, 1/data). More...
 
OutputPin m_en
 Starts data read/write. More...
 
OutputPin m_bt
 Back-light control (0/on, 1/off). More...
 

Static Protected Attributes

static const uint16_t SHORT_EXEC_TIME = 32
 

Detailed Description

HD44780 (LCD-II) Dot Matix Liquid Crystal Display Controller/Driver IO Port. Arduino pins directly to LCD in 4-bit mode.

Circuit

+------------+
(GND)---------------1-|VSS |
(VCC)---------------2-|VDD |
3-|VO |
(D8)----------------4-|RS |
5-|RW |
(D9)----------------6-|EN |
7-|D0 |
8-|D1 |
9-|D2 |
10-|D3 |
(D4/D0)------------11-|D4 |
(D5/D1)------------12-|D5 |
(D6/D2)------------13-|D6 |
(D7/D3)------------14-|D7 |
(VCC)-+------------15-|A |
ยก +--16-|K |
[4K7] | +------------+
| |
(D10)-+-[10K]-|< NPN 9013
(/BT) v
|
(GND)-----------+

The default pins are the LCD Keypad Shield.

Limitations

Requires too many pins for ATtinyX5.

Definition at line 350 of file HD44780.hh.

Constructor & Destructor Documentation

Construct HD44780 4-bit parallel port connected to given command, enable and backlight pin. Data pins are implicit; D4..D7 for Arduino Standard and Mighty. D0..D3 for ATtinyX4. Connect to LCD pins D4..D7.

Parameters
[in]d0data pin (Default D4).
[in]d1data pin (Default D5).
[in]d2data pin (Default D6).
[in]d3data pin (Default D7).
[in]rscommand/data select pin (Default D8).
[in]enenable pin (Default D9).
[in]btbacklight pin (Default D10).

Definition at line 364 of file HD44780.hh.

Member Function Documentation

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

Set backlight on/off using bt pin.

Parameters
[in]flag.

Implements HD44780::IO.

Definition at line 71 of file HD44780_Port4b.cpp.

void HD44780::Port4b::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 65 of file HD44780_Port4b.cpp.

bool HD44780::Port4b::setup ( )
virtual

Initiate 4-bit parallel port. Returns false.

Returns
bool.

Implements HD44780::IO.

Definition at line 26 of file HD44780_Port4b.cpp.

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

Write LSB nibble to display data pins.

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

Implements HD44780::IO.

Definition at line 32 of file HD44780_Port4b.cpp.

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

Write byte (8bit) to display.

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

Reimplemented from HD44780::IO.

Definition at line 45 of file HD44780_Port4b.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::Port4b::m_bt
protected

Back-light control (0/on, 1/off).

Definition at line 426 of file HD44780.hh.

OutputPin HD44780::Port4b::m_d0
protected

Data pin; d0.

Definition at line 420 of file HD44780.hh.

OutputPin HD44780::Port4b::m_d1
protected

Data pin; d1.

Definition at line 421 of file HD44780.hh.

OutputPin HD44780::Port4b::m_d2
protected

Data pin; d2.

Definition at line 422 of file HD44780.hh.

OutputPin HD44780::Port4b::m_d3
protected

Data pin; d3.

Definition at line 423 of file HD44780.hh.

OutputPin HD44780::Port4b::m_en
protected

Starts data read/write.

Definition at line 425 of file HD44780.hh.

OutputPin HD44780::Port4b::m_rs
protected

Register select (0/instruction, 1/data).

Definition at line 424 of file HD44780.hh.

const uint16_t HD44780::Port4b::SHORT_EXEC_TIME = 32
staticprotected

Execution time delay (us).

Definition at line 418 of file HD44780.hh.


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