74HC164

74HC164 – 8 Bit Serial In / Parallel Out

Hi guys,

today I show you a short tutorial how you can expand the I/O ports of your Arduino. The Arduino has 14 digital I/O Ports. Sometimes this is not enough. There are different ICs (74HC595, 74HC164,…) to expand the number of ports. I show you, how you can use the IC 74HC164.

The 74HC164 is an 8 Bit Serial In / Parallel Out circuit. With only 2 control ports you get 8 output ports.

Here is the circuit:

74HC164The functional diagramm:

74HC164a

The circuit has 14 pins.
8 pins (Q0..Q7) are the output pins, DS1 and DS2 are Serial In (you can use two different data sources – if not, you can both connect together), Vcc, GND, a Clock pin (CP) and a Reset pin (MR). That’s all.

A short test circuit:

Pin1 (DS1): connect to Arduino
Pin2 (DS2): connect to DS1
Pin3 (Q0):  connect to Resistor - LED - GND
Pin4 (Q1):  connect to Resistor - LED - GND
Pin5 (Q2):  connect to Resistor - LED - GND
Pin6 (Q3):  connect to Resistor - LED - GND
Pin7 (GND): connect to GND (Arduino)

Pin8 (CP):  connect to Arduino
Pin9 (MR):  connect to Vcc (reset; if set this pin to LOW, you send a reset)
Pin10 (Q4): connect to Resistor - LED - GND
Pin11 (Q5): connect to Resistor - LED - GND
Pin12 (Q6): connect to Resistor - LED - GND
Pin13 (Q7): connect to Resistor - LED - GND
Pin14 (Vcc): connect to Vcc (Arduino)

2014-02-05 21.05.58

byte ds1 = 3;
byte cp = 6;

void setup() {
  pinMode(ds1,OUTPUT);
  pinMode(cp,OUTPUT);
}

void loop() {
  // a qick code to show you how you can use the new pins
  // B11000011 - i.e. set 4 Bits to HIGH
  shiftOut(ds1, cp, LSBFIRST, B11000011);

  delay(500);
  // B10101010 - i.e. set 4 Bits to HIGH
  shiftOut(ds1, cp, LSBFIRST, B10101010);
  delay(500);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s