On Mar 31, 11:28 pm, Dylan Distasio <interz...@gmail.com> wrote:
> The fact
> that I have to do this serially one bit at a time seems like a pain in the
> neck.  Am I missing something (I'm sure I probably am) in terms of being
> able to set all 24 in parallel?


Dylan,

Nope, it's a serial shift register, so you do need send the data out
one bit at a time.

But it's totally not a problem on either the code or timing front. I'm
assuming you've got the 595s wired in a daisy chain, with the data
input of the first register wired to an IO bit on the microcontroller,
the data out of that 595 wired to the data input of the next etc.
Connect all the 595 clock pins together to a pin on your arduino,
ditto with the latch and output enable lines (if you're using the
latter).

The 595 will take the data essentially as fast as you can throw it out
(unless you're using a really exotic controller). There are a zillion
ways to code this, depending on whether you want speed, compact code,
want to use hardware assistance as David suggests elsewhere in the
thread. But honestly, there's no need to get flowery here - a simple
bit bang works perfectly in this setting. Here's a platform-
independent code snippet in C which is cut'n'pasted from the code for
my 42 tube clock (http://youtu.be/4FnxWsp58EM)


/*
** Function to write a byte to the shift register chain as fast as
needed.
** The argument is a byte of data which is simply inspected one bit at
a time,
** used to set the DATA line and then a fast clock pulse formed. No
manipulations
** are made of the latch or output enable lines - it is for the caller
** to ensure that these are managed appropriately. There are no
returns. It takes
** about 4us to blast out the whole byte.
**
** Usage:       write_SR(value);
**
**                      void write_SR();
**                      byte value;
*/

void write_SR(byte value)

{
                if (value & 0x80)
                               DATA = 1;
                else DATA = 0;
                CLOCK = 1;
                CLOCK = 0;
                if (value & 0x40)
                        DATA = 1;
                else DATA = 0;
                CLOCK = 1;
                CLOCK = 0;
                if (value & 0x20)
                        DATA = 1;
                else DATA = 0;
                CLOCK = 1;
                CLOCK = 0;
                if (value & 0x10)
                        DATA = 1;
                else DATA = 0;
                CLOCK = 1;
                CLOCK = 0;
                if (value & 0x08)
                        DATA = 1;
                else DATA = 0;
                CLOCK = 1;
                CLOCK = 0;
                if (value & 0x04)
                        DATA = 1;
                else DATA = 0;
                CLOCK = 1;
                CLOCK = 0;
                if (value & 0x02)
                        DATA = 1;
                else DATA = 0;
                CLOCK = 1;
                CLOCK = 0;
                if (value & 0x01)
                        DATA = 1;
                else DATA = 0;
                CLOCK = 1;
                CLOCK = 0;
}


You might ask why I don't have a loop as the code is so repetetive.
The answer is speed - I deliberately unrolled the loop because I have
a 160 bit shift register chain to manage for a multiplexed display
with cross-fades and some other quite complex display animations too.
Note that even for such a long shift register chain, there's no need
to worry about display glitching if you use the LATCH line. Just clock
all the bits through at your leisure and then pulse the LATCH line
once to update the output in one go.

Hope this helps some.

Jon.

-- 
You received this message because you are subscribed to the Google Groups 
"neonixie-l" group.
To post to this group, send an email to neonixie-l@googlegroups.com.
To unsubscribe from this group, send email to 
neonixie-l+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/neonixie-l?hl=en-GB.

Reply via email to