74HC165 Cascade of 3 Chips
Michael @ Afineol
Posts: 33
I would like to cascade 3 74HC165 IC's. I have read the StampWorks·section on how to setup the circuit, but the programming is what has me baffled. The documentation talks about cascading 2 chips and gives example code. It references a "word" sized variable which is 16 bits or 65535.·I will need to address 24 bits or 16777215. Does anyone have example code for a BS2 to address all·3 chips.
Mike S.
Mike S.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
http://forums.parallax.com/forums/default.aspx?f=5&m=181646
and I thought in the same way you are now, but it works out that you only have to send one word at a time (8 bits, 255) to each 74HC165 and keep shifting to the next chip.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Fernando Gomez
Never compare yourself with anyone else, there will always be someone bigger·or·smaller·than you.
From the Stamp Works manual, the following code shifts in 16 bits into a word variable. But that doesn’t mean you have to deal with a word at a time.
Any number of byte values can be shifted in with a single instruction as follows.· I hope this helps.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
'{$STAMP BS2}
'{$PBASIC 2.5}
dat PIN 1
clk PIN 0
latch PIN 2
start:
LOW latch
SHIFTOUT dat, clk, LSBFIRST, [noparse][[/noparse]1]: SHIFTOUT dat, clk, LSBFIRST, [noparse][[/noparse]3]:· SHIFTOUT dat, clk, LSBFIRST,[noparse][[/noparse]7]:· SHIFTOUT dat, clk, LSBFIRST,[noparse][[/noparse]15]:· SHIFTOUT dat, clk, LSBFIRST,[noparse][[/noparse]31]:· SHIFTOUT dat, clk, LSBFIRST,[noparse][[/noparse]63]
PULSOUT latch, 5
LOW latch
Post Edited (willy1067) : 12/21/2007 11:02:48 PM GMT
I wonder if you’re not using the 74HC165, but rather the 74HC595? The SHIFTOUT command is not used with the 74HC165. It is, however, used with the 74HC595, and to SHIFTOUT the values from your example you could have used:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Can you help with this code?·· I am attaching a stepper motor to the 5th 595, I would like to move foward if pin3 is set high with a push button.· this is what I have so far,· (as I said before, I suck·as a programmer)
' {$STAMP BS2}
' {$PBASIC 2.5}
DO
Steps DATA 3, 6, 12, 9
dat PIN 1
clk PIN 0
latch PIN 2
start:
LOW latch
SHIFTOUT dat, clk, LSBFIRST, [noparse][[/noparse]0, 0, 0, 0, Steps, 0]
PULSOUT latch, 5
LOW latch
DEBUG ?IN3
IF (IN3 = 1) THEN Steps
PAUSE 1000
ELSE PAUSE 100
LOOP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Fernando Gomez
Never compare yourself with anyone else, there will always be someone bigger·or·smaller·than you.
Post Edited (willy1067) : 12/29/2007 6:12:27 AM GMT