Kronos Robotics and Electronics
Site Map
 
Home Zeus Projects App Notes Downloads Dios Athena Forums
 

DAN137

Interface to a 74HC595 Shift Register

  By Michael Simpson

If you have ever wanted to add a few more output ports to your Dios this is the cheapest and easiest way.   The 74HC595 is a 8 bit shift register.  It uses three IO ports but you will gain 8 output ports.  It is possible to use this device to interface to other 8bit items such as DACS or EEPROMS.   Also if your going to display lots of data via LED's then there is nothing better.  You can even tie more than one chip together to create larger registers.

Schematics

I'm going to show hookup to the Dios Ultra Mini.  However the connection to other Dios form factors are the same.

 

In this first schematic I connect a Dios to a single 595 shift register.   I have connected a LED (with internal resistor) to each of the output leads of the 595.

 

In this schematic I show the Dios connected to two 595 shift registers.  This gets you a 16bit shift register.

 

 

Program 1 Download it here

func main()
   dim x

   HC595init(0,1,2)

again:

   for x = 0 to 255
      HC595write(x)
      pause 10
    next

   goto again

endfunc

include \lib\Dios595.lib

This program will cycle through the each bit (in binary) of of the shift register.

 

Program 2 Download it here

func main()
   dim x

   HC595init(0,1,2)

   HC595write(0)

again:

   high595(0)
   pause 100
   low595(0)
   pause 100

goto again

endfunc

include \lib\Dios595.lib

This program shows you how to access a single port on the shift register.

 

Library Description

HC595init(serin,clk,latch)

This function must be called before any of the others.

serin is the serial input pin to the 595.

clk is the clock pin on the 595.

latch is the latch pin on the 595.

HC595write(value)

This is the work horse of the library.  The value represents the 8 output pins on the 595.  So a value of 255 will set all the pins to high and value of 0 will set them all low.

HC595writem(num,value1,.....)

If you cascade more than 1 595 you can use this command to access them.

num is used to tell the function how many 595's are connected. 

You then provide a value for each 595.

HC595high(port)

This command sets an individual port on the 595 to high.  Ports are numbered from 0 to 7.

HC595low(port)

This command sets an individual port on the 595 to low.  Ports are numbered from 0 to 7.

 

 

Parts list

74HC595

 

DiosPro 40 Pin Chip

Dios Workboard Deluxe

 

Easy RS232 Driver  

DiosPro 28 Pin Chip

Dios 32 Pin Carrier (Carrier #1)

 

9 Pin Cable

Breadboard Regulator

 

Copyright © 2001 - 2007 Kronos Robotics