74hc164 Schematic & Sample Code
everest
Posts: 141
Hello,
I need to free up some pins from my Stamp2 application. After doing some digging and research it appears that the simplest way to do this is via a 74hc164 for inputs and a 74HC595 for outputs. I dug and for the life of me I can't seem to find a simple example of how to build a circuit along with sample code. I just know there is a Nuts & Volts article out there waiting that covers this. . .I found one, but it looks like they are using a totally separate PIC microcontroller and I'd like to avoid that if I can.
Any suggestions/pointers?
-JEff
I need to free up some pins from my Stamp2 application. After doing some digging and research it appears that the simplest way to do this is via a 74hc164 for inputs and a 74HC595 for outputs. I dug and for the life of me I can't seem to find a simple example of how to build a circuit along with sample code. I just know there is a Nuts & Volts article out there waiting that covers this. . .I found one, but it looks like they are using a totally separate PIC microcontroller and I'd like to avoid that if I can.
Any suggestions/pointers?
-JEff
Comments
Schematics (with 8 LED's connected):
Code:
74HC165
Schematics (with 8 switches):
Code:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
Also, forgot RETURN statement in the 165 code snippet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
I do still have one remaining question though. . .is it possible to read the current position of the outputs controlled by the 75HC595? The examples provided and the ones I found show how to write and change the state, but not necessarily how to read the state of all the switches. I really need to be able to do both. . .
-Jeff
Post Edited (everest) : 8/31/2009 1:18:24 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
-Jeff
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
How would I write Activity #3 from Chapter#3 using· the 74HC165?· Here is the input from the book:
' {$STAMP BS2}
' {$PBASIC 2.5}
' Whats a Microcontroller - CH3ACT3PushbuttoncontrolledLED.bst
' Check· pushbutton state 10 times per second and blink LED when pressed.
DO
· DEBUG ? IN3
· IF (IN3 = 1) THEN
··· HIGH 14
··· PAUSE 50
··· LOW 14
··· PAUSE 50
· ELSE
··· PAUSE 100
· ENDIF
LOOP
I have the·attached schematic wired up with my BS2... but frankly I don't know what my input labels will be (IN3 above will be what now that I have· an input going through the 74HC165 chip???).· Am I thinking about this the wrong way?·
Any advice out there?· Please be specific... and dumb it down for me a bit.
Thanks!
Kevin