navigationGo.pngQuick Navigation
allprojects32.pngAll projects
hardware32.pngHardware
links32.pngLinks

favoriteStar32.pngTop projects
Alan numitron clock
Clapclap 2313/1386
SNES Pi Webserver
USB Volume/USB toys
Smokey amp
Laser cutter
WordClock
ardReveil v3
SNES Arcade cabinet
Game boy projects
cameleon
Home Presence Detector

github32.pngGitHub
AlanFromJapan

navigationMail.pngContact me

alanfjmail.png
3flags.pngWho's Alan?


Akizukidenshi
Elec-lab
Rand Nerd Tut
EEVblog
SpritesMods
AvrFreaks
Gameboy Dev
FLOZz' blog
Switch-science
Sparkfun
Suzusho
Datasheet Lib
Reddit Elec
Ermicro
Carnet du maker (fr)

Arduino and Shift-registers

Last update: Thu Jun 5 22:25:40 2025
kalshagar - Arduino and Shift-registers

General documentation


ON 74LS164 - 8bit Serial-in / Parallel-out

74LS164.pdf

74HC595 - 8bit Serial-in / Parallel-out (with output latch)


TI SN74198 - 8 bit Serial-in Parallel-in / Parallel-out

SN74198.pdf

Fairchild CD4014 - 8 bits shift register

Accepts parallel or serial in, and gives parallel or serial out

Fairchild CD4015 - Dual 4 bits shift register

CD4015.pdf

For the CD4015, make it a 8 bit by simply linking 4bit SIPO A & B:
  • Link Output A4 to Data B
  • Link the clock A & B together and reset A & B together
  • Push data only through Data A
  • Read 8 bit A1 A2 A3 A4 B1 B2 B3 B4
//Shift register write method
void shiftReg_Write (byte pByte){
  //i must be a int, if you put a byte if crash on the uC
  for (int i = 7 ; i >= 0; i--){
    byte v = (pByte >> i) & B00000001;
    if (v == 1){
      digitalWrite(CD4015_DATA, HIGH);
    }
    else {
      digitalWrite(CD4015_DATA, LOW);
    }
 
    digitalWrite(CD4015_CLOCK, LOW);
    delayMicroseconds(15); //needs average of 15us
    digitalWrite(CD4015_CLOCK, HIGH);
    delayMicroseconds(15); needs average of 15us <- IMPORTANT!
  }
}
All content on this site is shared under the MIT licence (do what u want, don't sue me, hat tip appreciated)
electrogeek.tokyo ~ Formerly known as Kalshagar.wikispaces.com and electrogeek.cc (AlanFromJapan [2009 - 2025])