Agent Cobalt
07-04-2009, 10:53 AM
I'm currently working on a project and found myself needing more outputs than the propeller could provide. I had a few 74HC595's hanging around my parts bins and decided to use them. I've never actually used the 74HC595 before and so I decided to see if there was an object I could use on the OBEX. I came across Dennis Ferron's object pack and am using the 74HC595_Regular object. My project has 2 74HC595's cascaded in the following manner:
┌──────┐
QB ┫1• 16┣ Vcc
QC ┫2 15┣ QA
QD ┫3 14┣─────────────────────────────── ← A (Data in from Propeller)
QE ┫4 13┣─────────────────────• Output Enable (Tied to ground)
QF ┫5 12┣───────────────┐
QG ┫6 11┣─────────────┐ │
QH ┫7 10┣──────────────────┐
gnd ┫7 9┣───────┐ QH' │ │ │
└──────┘ │ │ │ │
│ │ │ │
┌──────┐ │ │ │ │
QB ┫1• 16┣ Vcc │ │ │ │
QC ┫2 15┣ QA │ │ │ │
QD ┫3 14┣───────┘ A │ │ │
QE ┫4 13┣─────────────│─│──│───• Output Enable (Tied to ground)
QF ┫5 12┣─────────────│─┻──│───• Latch Clock (to LatchPin from Propeller)
QG ┫6 11┣─────────────┻────│───• Shift Clock (to ClockPin from Propeller)
QH ┫7 10┣──────────────────┻───• RESET (to Propeller's Reset pin)
gnd ┫7 9┣ Qh'
└──────┘
The problem I'm experiencing is that in using the call to set the outputs, the outputs of both 74HC595's are the exact same.
Here's a snippet of code in which I'm setting the outputs:
HC595.Out(Main, 0) 'Output main signals to chip 0.
HC595.Out(Cross, 1) 'Output aux signals to chip 1.
Now, according to Dennis's object, you send out the 8 bits as the first parameter and the second parameter is which chip in the cascade.
Determined to try and find a working method, I tried my hand at using the SPI object that is in the Propeller library. This one yielded a more entertaining effect as the outputs from the chips are not even matching the bit pattern I would send out with the object regardless of whether I sent it out using MSB first or LSB first.
SPI.SHIFTOUT(Dat_595_1, Clk_595_1, SPI#MSBFIRST , 16, %0001000100000001)
ToggleLatch(Ltc_595_1)
I've tried different things to try to get the chips working in cascade, but other changes ended up not working or working partially, but the outputs on one chip would be 'ghosted' on the other in that the LEDs (used to see the output states) would be slightly light on the ghost pins. Any pointers or ideas with what I'm doing wrong would be helpful as I've never used this chip nor have I used any chips that use the SPI protocol so I don't know much about it either.
┌──────┐
QB ┫1• 16┣ Vcc
QC ┫2 15┣ QA
QD ┫3 14┣─────────────────────────────── ← A (Data in from Propeller)
QE ┫4 13┣─────────────────────• Output Enable (Tied to ground)
QF ┫5 12┣───────────────┐
QG ┫6 11┣─────────────┐ │
QH ┫7 10┣──────────────────┐
gnd ┫7 9┣───────┐ QH' │ │ │
└──────┘ │ │ │ │
│ │ │ │
┌──────┐ │ │ │ │
QB ┫1• 16┣ Vcc │ │ │ │
QC ┫2 15┣ QA │ │ │ │
QD ┫3 14┣───────┘ A │ │ │
QE ┫4 13┣─────────────│─│──│───• Output Enable (Tied to ground)
QF ┫5 12┣─────────────│─┻──│───• Latch Clock (to LatchPin from Propeller)
QG ┫6 11┣─────────────┻────│───• Shift Clock (to ClockPin from Propeller)
QH ┫7 10┣──────────────────┻───• RESET (to Propeller's Reset pin)
gnd ┫7 9┣ Qh'
└──────┘
The problem I'm experiencing is that in using the call to set the outputs, the outputs of both 74HC595's are the exact same.
Here's a snippet of code in which I'm setting the outputs:
HC595.Out(Main, 0) 'Output main signals to chip 0.
HC595.Out(Cross, 1) 'Output aux signals to chip 1.
Now, according to Dennis's object, you send out the 8 bits as the first parameter and the second parameter is which chip in the cascade.
Determined to try and find a working method, I tried my hand at using the SPI object that is in the Propeller library. This one yielded a more entertaining effect as the outputs from the chips are not even matching the bit pattern I would send out with the object regardless of whether I sent it out using MSB first or LSB first.
SPI.SHIFTOUT(Dat_595_1, Clk_595_1, SPI#MSBFIRST , 16, %0001000100000001)
ToggleLatch(Ltc_595_1)
I've tried different things to try to get the chips working in cascade, but other changes ended up not working or working partially, but the outputs on one chip would be 'ghosted' on the other in that the LEDs (used to see the output states) would be slightly light on the ghost pins. Any pointers or ideas with what I'm doing wrong would be helpful as I've never used this chip nor have I used any chips that use the SPI protocol so I don't know much about it either.