PDA

View Full Version : 74HC595 help



shmow
05-25-2008, 10:17 AM
Hello All,
I had a program working nicely with the basic stamp2, and I reconstructed the project with the prop.
Everything was working with the prop and this serial output to a 7 segment display.
Then, I add the EMIC module and suddenly the 7 segment display doesn't work.
In the simple program included - see below - the first signal (%00000001)ˇshould illuminate segment "A", but instead it illuminates segments "A" and "B".
The second binary signal (%00000010) should illuminate segment "B", but instead it jumps to segments "C" and "D".
The last binary signal (%00000100) illuminates segments "E" and "F" when it should illuminate segment "C".
This simple program just cycles through these three commands and then repeats itself.
I've used a pulldown (10k Ohm) on the latch output from the prop.
I've even connected aˇ470 Ohm resistor on each prop output pin - 0, 1 & 2.
The oscilliscope showed twice as many pulses as it did earlier when everything was working properly.
I'm scratching my head on this one because it worked so beautifully for a while then suddenly fell apart.
I was using the PE kit but that chip doesn't work any more, and now I'm using the demo kit.
One final note: when initially troubleshooting, I would send just one signal instead of three different signals, and the appropriate segment would light up.ˇ However, when I sent a series of 3 different signals at 1 second intervals.ˇˇThat's when things would get mixed up or "leapfrog".
Would anyone have any advice with this?



{{PROP LED PROP 74HC595
────────────── ──────────── ───────────── ───────────────────────────────────────────── ─

3.3V P 8 P 13
P 1 Data Out ─── P 14 Data In  │ │
P 0 Clock ─── P 11 Clock ┣──────┐ ┣─────┘
P 2 Latch ─┳─ P 12 Latch   
│ P 10 P 16 GND
 10 kΩ

GND



────────────────────────────────────────────────── ───────────────────────────────────────────── ──
SEVEN SEGMENT DISPLAY COMMON CATHODE
7 SEG 595
10 6 ─────── 100 Ω ───────
 A  P10 (G) ── P6
│ │ P9 (F) ── P5
F B P7 (A) ── P15
│ │ P6 (B) ── P1
── G ── P4 (C) ── P2
│ │ P2 (D) ── P3
E C P1 (E) ── P4
│ │ P3 ─── GND
 D  P8 ─── GND
1 5

}}

CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
'Pin Assignments
ClockPin = 0
SerialDataPin = 1
LatchPin = 2

VAR
byte Pattern_10s

OBJ
BS2 : "BS2_Functions" ' Create BS2 Object
PUB Main
BS2.start (31,30)
repeat
'GFEDCBA
Pattern_10s := %00000001
BS2.SHIFTOUT(SerialDataPin, ClockPin, Pattern_10s, BS2#MSBFIRST, 8) '10's - 7 seg display
BS2.PULSOUT(LatchPin,5)
waitcnt(clkfreq+cnt)
'GFEDCBA
Pattern_10s := %00000010
BS2.SHIFTOUT(SerialDataPin, ClockPin, Pattern_10s, BS2#MSBFIRST, 8) '10's - 7 seg display
BS2.PULSOUT(LatchPin,5)
waitcnt(clkfreq+cnt)
'GFEDCBA
Pattern_10s := %00000100
BS2.SHIFTOUT(SerialDataPin, ClockPin, Pattern_10s, BS2#MSBFIRST, 8) '10's - 7 seg display
BS2.PULSOUT(LatchPin,5)
waitcnt(clkfreq+cnt)




Much appreciated,
Shmow
ˇ