Maker Pro
Maker Pro

Shift registers : no output ?

A

aalex

Jan 1, 1970
0
Hi !
I am trying to drive 16 LED using a microcontroller and two 74HC595N
shift registers. It didn't get to control a single LED so far. When I
upload the code, the LED become either HIGH or LOW, but I can't
control them.

Below is a pseudo-code of the actions executed by the microcontroller.
Everything seems to wired correctly, but it still doesn't seem to
work. I need to drive some LED with that. I tested the output with a
multimeter, and every pin out stays at HIGH (5V). I wired everything
like in this circuit : http://www.ucapps.de/mbhp/mbhp_doutx4.pdf The
microcontroller receives the data well : I can verify it.

Everything seems ok :
* The "output enable" pin is active (LOW).
* The "master reset" pin is inactive (HIGH).
* I need to power LED that need 30mA : this could be an issue, but
still, the multimeter tells me that there is no fluctuation in the
output voltagee of every shift register in my circuit.

Here is the pseudo-code :

set the "storage register clock input" pin to LOW
for each register's output pin from 0 to 15 do: (I use two shift
registers)
set the "serial data input" pin to some value
set the "shift register clock input" pin to LOW
set the"shift register clock input" pin to HIGH (this clock pin is
low-to-high triggered)
set the "storage register clock input" to HIGH (this clock pin is low-
to-high triggered as well)

Anything wrong with this algorithm ? Someone can point me to an error
I might have committed.

Thanks a lot !

alexandre
 
H

Helmut Sennewald

Jan 1, 1970
0
aalex said:
Hi !
I am trying to drive 16 LED using a microcontroller and two 74HC595N
shift registers. It didn't get to control a single LED so far. When I
upload the code, the LED become either HIGH or LOW, but I can't
control them.

Below is a pseudo-code of the actions executed by the microcontroller.
Everything seems to wired correctly, but it still doesn't seem to
work. I need to drive some LED with that. I tested the output with a
multimeter, and every pin out stays at HIGH (5V). I wired everything
like in this circuit : http://www.ucapps.de/mbhp/mbhp_doutx4.pdf The
microcontroller receives the data well : I can verify it.

Everything seems ok :
* The "output enable" pin is active (LOW).
* The "master reset" pin is inactive (HIGH).
* I need to power LED that need 30mA : this could be an issue, but
still, the multimeter tells me that there is no fluctuation in the
output voltagee of every shift register in my circuit.

Here is the pseudo-code :

set the "storage register clock input" pin to LOW
for each register's output pin from 0 to 15 do: (I use two shift
registers)
set the "serial data input" pin to some value
set the "shift register clock input" pin to LOW
set the"shift register clock input" pin to HIGH (this clock pin is
low-to-high triggered)
set the "storage register clock input" to HIGH (this clock pin is low-
to-high triggered as well)

Anything wrong with this algorithm ? Someone can point me to an error
I might have committed.

Thanks a lot !

alexandre

Hello Alexandre,

The schematic and your code seems to be ok.

Have you checked that your control signals have 0V/5V levels?
Many modern microprocessors run with less than 5V today.
The circuit wouldn't work with a high level of 3.3V for example.

Best regards,
Helmut
 
J

John Fields

Jan 1, 1970
0
Hi !
I am trying to drive 16 LED using a microcontroller and two 74HC595N
shift registers. It didn't get to control a single LED so far. When I
upload the code, the LED become either HIGH or LOW, but I can't
control them.

Below is a pseudo-code of the actions executed by the microcontroller.
Everything seems to wired correctly, but it still doesn't seem to
work. I need to drive some LED with that. I tested the output with a
multimeter, and every pin out stays at HIGH (5V). I wired everything
like in this circuit : http://www.ucapps.de/mbhp/mbhp_doutx4.pdf The
microcontroller receives the data well : I can verify it.

Everything seems ok :
* The "output enable" pin is active (LOW).
* The "master reset" pin is inactive (HIGH).
* I need to power LED that need 30mA : this could be an issue, but
still, the multimeter tells me that there is no fluctuation in the
output voltagee of every shift register in my circuit.

Here is the pseudo-code :

set the "storage register clock input" pin to LOW
for each register's output pin from 0 to 15 do: (I use two shift
registers)
set the "serial data input" pin to some value
set the "shift register clock input" pin to LOW
set the"shift register clock input" pin to HIGH (this clock pin is
low-to-high triggered)
set the "storage register clock input" to HIGH (this clock pin is low-
to-high triggered as well)

Anything wrong with this algorithm ? Someone can point me to an error
I might have committed.

---
Your "set the "storage register clock input" pin to LOW" seems to
be outside the loop, which means the register clock will never be
reset after it's asserted the first time.


If you want your outputs to change sequentially, your code should
look something like this:


load a counter with hex 10
set the "shift register clock input" pin to LOW
set the "storage register clock input" pin to LOW
loop: set the "serial data input" pin to some value
set the"shift register clock input" pin to HIGH
set the "shift register clock input" pin to LOW
set the "storage register clock input" to HIGH
set the "storage register clock input" to LOW
decrement the counter
is the count > 0?
if yes, goto loop
 
J

John Fields

Jan 1, 1970
0
---
Your "set the "storage register clock input" pin to LOW" seems to
be outside the loop, which means the register clock will never be
reset after it's asserted the first time.


If you want your outputs to change sequentially, your code should
look something like this:


load a counter with hex 10
set the "shift register clock input" pin to LOW
set the "storage register clock input" pin to LOW
loop: set the "serial data input" pin to some value
set the"shift register clock input" pin to HIGH
set the "shift register clock input" pin to LOW
set the "storage register clock input" to HIGH
set the "storage register clock input" to LOW
decrement the counter
is the count > 0?
if yes, goto loop
.
.
.

Alternatively, you could wire the shift clock and the register clock
in parallel, in which case the outputs would change sequentially,
but output would lag input by one clock.

Your code would then look something like this:

load a counter with hex 11
set the "shift register clock input" pin to LOW

loop: set the "serial data input" pin to some value
set the"shift register clock input" pin to HIGH
set the "shift register clock input" pin to LOW
decrement the counter
is the count > 0?
if yes, goto loop
 
J

John B

Jan 1, 1970
0
Hi !
I am trying to drive 16 LED using a microcontroller and two 74HC595N
shift registers. It didn't get to control a single LED so far. When I
upload the code, the LED become either HIGH or LOW, but I can't
control them.

Below is a pseudo-code of the actions executed by the microcontroller.
Everything seems to wired correctly, but it still doesn't seem to
work. I need to drive some LED with that. I tested the output with a
multimeter, and every pin out stays at HIGH (5V). I wired everything
like in this circuit : http://www.ucapps.de/mbhp/mbhp_doutx4.pdf The
microcontroller receives the data well : I can verify it.

Everything seems ok :
* The "output enable" pin is active (LOW).
* The "master reset" pin is inactive (HIGH).
* I need to power LED that need 30mA : this could be an issue, but
still, the multimeter tells me that there is no fluctuation in the
output voltagee of every shift register in my circuit.

Here is the pseudo-code :

set the "storage register clock input" pin to LOW
for each register's output pin from 0 to 15 do: (I use two shift
registers)
set the "serial data input" pin to some value
set the "shift register clock input" pin to LOW
set the"shift register clock input" pin to HIGH (this clock pin is
low-to-high triggered)
set the "storage register clock input" to HIGH (this clock pin is low-
to-high triggered as well)

Anything wrong with this algorithm ? Someone can point me to an error
I might have committed.

Thanks a lot !

alexandre

You might be better doing it the way the data sheet shows:

set the "storage register clock input" pin to LOW
set the "shift register clock input" pin to LOW for each register's

output pin from 0 to 15 do:

set the "serial data input" pin to some value
set the"shift register clock input" pin to HIGH
set the "shift register clock input" pin to LOW

set the "storage register clock input" to HIGH
set the "storage register clock input" pin to LOW
 
S

Steve

Jan 1, 1970
0
aalex said:
Hi !
I am trying to drive 16 LED using a microcontroller and two 74HC595N
shift registers. It didn't get to control a single LED so far. When I
upload the code, the LED become either HIGH or LOW, but I can't
control them.

Below is a pseudo-code of the actions executed by the microcontroller.
Everything seems to wired correctly, but it still doesn't seem to
work. I need to drive some LED with that. I tested the output with a
multimeter, and every pin out stays at HIGH (5V). I wired everything
like in this circuit : http://www.ucapps.de/mbhp/mbhp_doutx4.pdf The
microcontroller receives the data well : I can verify it.

Everything seems ok :
* The "output enable" pin is active (LOW).
* The "master reset" pin is inactive (HIGH).
* I need to power LED that need 30mA : this could be an issue, but
still, the multimeter tells me that there is no fluctuation in the
output voltagee of every shift register in my circuit.

Here is the pseudo-code :

set the "storage register clock input" pin to LOW
for each register's output pin from 0 to 15 do: (I use two shift
registers)
set the "serial data input" pin to some value
set the "shift register clock input" pin to LOW
set the"shift register clock input" pin to HIGH (this clock pin is
low-to-high triggered)
set the "storage register clock input" to HIGH (this clock pin is low-
to-high triggered as well)

Anything wrong with this algorithm ? Someone can point me to an error
I might have committed.

Thanks a lot !

alexandre

Your pseudocode and schematic looks right - standard SPI kind of
implementation. I assume that the line:
set the "storage register clock input" to HIGH (this clock pin is low-
to-high triggered as well)
is after the for-loop, which is correct.

If you set the clock line low then high immediately, you could create a very
narrow pulse if your processor is running at a high clock rate. Make sure
you meet the minimum clock time for the HC595. Add long lines and parasitic
capacitances, and you might not get a valid signal level, rise time or pulse
width at the 595 SCK inputs.

I have found 595's RCLK line to be susceptible to noise and false
registering in several applications like this. Consequently, I usually put
100-300 pf to ground on the RCLK line to squash noise pulses. It has proven
effective at fixing erroneous outputs in several cases.

If you haven't already done this, try slowing the whole clocking process
down to the 100 Hz - 1kHz region, to see if things begin to operate
correctly.

When you say the "microprocessor receives the data well", do you mean you
are reading back the previous message from the far end of the chain? If you
get the right stuff back, then obviously the 595's accepted the bits
correctly. That would point to a problem with RCLK transferring the stored
data to the output pins.

And I agree with Helmut's comment to assure your processor outputs are high
enough for the HC595. I usually use HCT parts to get the lower input
threshold with 3.3V processors, and I still usually add 5V pull-ups to be
sure, as long as the processor outputs are 5V tolerant.

Good luck,
Steve
 
Top