Lightweight Arduino library to control HD44780-compatible LCDs through a 74HC595 shift register.
LCDShiftView reduces wiring to 3 Arduino pins (data, clock, latch) while keeping common LiquidCrystal-style controls.
It also includes helper APIs to make screen updates easier without extra code in user sketches.
- Works with standard HD44780 LCDs (16x2, 20x4, etc.)
- 3-wire control through one 74HC595
- Flexible mapping for LCD pins (
RS,E,D4..D7) - Backlight control
- Custom characters
- Fast internal write path and reduced overhead for small boards
- Extra helper methods:
printAt,writeAt,clearRow,clearArea,printPadded,printCentered,printfAt,setRowOffsets - Runtime tuning:
setBacklightBit,setTimings, andbegin(..., backlightOn)
Typical mapping:
| LCD Pin | Connect to 74HC595 |
|---|---|
| RS | Q0 |
| E | Q1 |
| D4 | Q2 |
| D5 | Q3 |
| D6 | Q4 |
| D7 | Q5 |
| BL (optional) | Q7 |
74HC595 to Arduino:
| 74HC595 Pin | Arduino |
|---|---|
| DS | Data pin |
| SHCP | Clock pin |
| STCP | Latch pin |
#include <LCDShiftView.h>
const uint8_t dataPin = 10;
const uint8_t clockPin = 11;
const uint8_t latchPin = 12;
LCDShiftView lcd(dataPin, clockPin, latchPin);
void setup() {
lcd.begin(16, 2);
lcd.print("Hello");
}
void loop() {
}Print text directly at a specific location.
lcd.printAt(0, 0, "Temp:");Write one byte/character at a location.
lcd.writeAt(15, 1, '*');Fill one row with a character (default is space).
lcd.clearRow(1); // clear row 1
lcd.clearRow(0, '-'); // fill row with '-'Fill a rectangular area.
lcd.clearArea(5, 0, 6); // clear 6 chars in row 0
lcd.clearArea(0, 0, 16, 2, '.'); // fill full 16x2 with dotsPrint text in fixed width and fill remaining space.
lcd.printPadded(6, 0, "27.3C", 10); // overwrites old longer values cleanly
lcd.printPadded(0, 1, F("READY"), 16, ' ');Center text in a row.
lcd.printCentered(0, "READY");
lcd.printCentered(1, F("WAIT"));Print formatted values at a fixed location.
lcd.printfAt(0, 1, "V=%d I=%d", volts, amps);Set custom DDRAM row offsets for non-standard displays.
lcd.setRowOffsets(0x00, 0x40, 0x14, 0x54);Use a different 74HC595 output bit for backlight control.
lcd.setBacklightBit(7); // defaultTune instruction delays for specific LCD modules.
lcd.setTimings(37, 1520);begin(cols, rows, charsize = 0x00)begin(cols, rows, charsize, backlightOn)clear(),home()clearRow(...),clearArea(...)setCursor(col, row),printAt(...),writeAt(...),printfAt(...)print(...),println(...),write(...)display(),noDisplay()cursor(),noCursor()blink(),noBlink()scrollDisplayLeft(),scrollDisplayRight()leftToRight(),rightToLeft()autoscroll(),noAutoscroll()createChar(location, charmap)backlight(state)setBacklightBit(bit)setPins(rs, e, d4, d5, d6, d7)setRowOffsets(r0, r1, r2, r3)setTimings(execUs, clearHomeUs)getRowOffset(row)(deprecated)
- For very small MCUs, prefer
const char*/F("...")for constant text. - Repeatedly printing dynamic values is easier with
printPaddedto avoid leftover characters. - If your LCD has unusual row layout, use
setRowOffsets. printfAtuses a configurable buffer size viaLCDSHIFTVIEW_PRINTF_BUFFER(default64).
examples/HelpersQuick/HelpersQuick.ino:printAt,writeAt,printCenteredexamples/RowHelpers/RowHelpers.ino:clearRow,printPaddedexamples/CustomRowOffsets/CustomRowOffsets.ino:setRowOffsets,getRowOffsetexamples/AdvancedInit/AdvancedInit.ino:begin(..., backlightOn),setBacklightBit,setTimingsexamples/ClearArea/ClearArea.ino:clearAreaexamples/PrintfAt/PrintfAt.ino:printfAtexamples/FlashHelpers/FlashHelpers.ino: helper methods withF("...")
See LICENSE.