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

AAN140

Interface to a 74HC165 Shift Register

and gain input ports

  By Michael Simpson

Using the 74HC595 we were able to add some output ports.   Now lets add a few input ports.  we will use the 74HC165 shift register.

The process is pretty easy on the Athena because we have a command just for talking to a 74HC165 chip.

srin

You supply the three interface leads and it will read all 8 ports into the supplied variable.

 

Schematic

Schematic 1

 

Very simple program.  It will read the ports and diplay them in a single value.  Each port represents a single bit.

Program 1


'srin demo

dim dat

loop:
   srin 0,1,2,dat
   print dat
   goto loop

 

Now lets take it one step further.  The Athena has a command called srinport.  This command will read an individual port from the shift register.

Program 2

'srinport demo

const load165 2
const dat165 0
const clk165 1

dim dat,x

loop:
   for x = 0 to 7
      srinport dat165,clk165,load165,x,dat
      print x,"=",dat
    next
    print
    pause 255
    goto loop

In the above example x is the actual port you want to read.

 

Going further

You can share the load and clock leads if you want to connect to multiple shift-in registers.

Parts

Easy RS232 Driver  

Athena

74HC165

 

7.5V AC Adapter

9 Pin Cable

Breadboard and Wire Kit

Breadboard Regulator

 

Copyright © 2001 - 2007 Kronos Robotics