Maker Pro
Maker Pro

Controlling hundreds of LEDs

D

Danny T

Hi All,

I'm trying to control hundreds of LEDs from my parallel port (8 data
pins - will soon be replaced with the output of a programmed PIC, also 8
pins).

I'm not an electronics guy (I'm a software developer), so trying to
control x00's of LEDs from 8 pins looks a bit tricky...

There's no way to change them all at the same time, so I reckon I'll
need some sort of "addressing" system. Using some of the pins to select
which LED I'm controlling, and one for the data.

Trouble is, even using 7 bits as the "address", I've only got 128
channels, but I imagine I'd need a bit for "send" too, so I can set the
address and the data, then have it read in one go.

What are my options? And what components would I need to achieve
something like this (I imagine right down at the end, I'll need a number
of registers for the LEDs. If these come in chips with 8 output legs, I
guess I'll need 38 for 300 LEDs. The bit between my 8 data pins and the
computer isn't my area though, so I'm stuck!

Oh, and this is just a hobby thing, so the cheaper the better. I'm sure
I can already buy scrolling screens, but I don't have the money, and I
want the fun of building one! :)
 
J

John Fields

Hi All,

I'm trying to control hundreds of LEDs from my parallel port (8 data
pins - will soon be replaced with the output of a programmed PIC, also 8
pins).

I'm not an electronics guy (I'm a software developer), so trying to
control x00's of LEDs from 8 pins looks a bit tricky...

There's no way to change them all at the same time, so I reckon I'll
need some sort of "addressing" system. Using some of the pins to select
which LED I'm controlling, and one for the data.

Trouble is, even using 7 bits as the "address", I've only got 128
channels, but I imagine I'd need a bit for "send" too, so I can set the
address and the data, then have it read in one go.

What are my options? And what components would I need to achieve
something like this (I imagine right down at the end, I'll need a number
of registers for the LEDs. If these come in chips with 8 output legs, I
guess I'll need 38 for 300 LEDs. The bit between my 8 data pins and the
computer isn't my area though, so I'm stuck!

Oh, and this is just a hobby thing, so the cheaper the better. I'm sure
I can already buy scrolling screens, but I don't have the money, and I
want the fun of building one! :)
 
D

Dominic-Luc Webb

pins - will soon be replaced with the output of a programmed PIC, also 8
pins).

I'm not an electronics guy (I'm a software developer), so trying to
control x00's of LEDs from 8 pins looks a bit tricky...


May I ask if you can take advantage of any of the status bits?

Is there any pattern to how the LEDs are turned on and off? Are there
groups that can bit always be lit simultaneously or must they all be
controlled independently?

Maybe some can be lit up sequentially? In this case, maybe a 555 timer
connected to a counter series could reduce the number of permutations
required of the parallel port.

The parallel port data bits can be made to go high and low at different
frequencies. I believe it operates at 8 Mhz, but at any given moment,
it should be possible to dictate which pins go high and low. By cycling
back and forth, you create on/off states with frequencies you can choose
by software. If you are willing/able to build a frequency detecting
circuit, this could buy you a lot of additional permutations.

Consider the following set of bits I used to operate 4 stepper motors
that needed to turn at different speeds (I'll show 2 of the motors).
First bit indicates forward or reverse, while 2nd bit indicates step
or no step.

Motor 1 (data bits 0 and 1)
00
00
00
11
00
00
00
11


Motor 2 (data bits 2 and 3)
01
00
01
00
01
00
01


What my software sent out for the first bits:

0001
0000
0001
1100
0001
0000
0001
1100


Note that data bits 0 and 1 are cycling at twice the frequency as
data bit 3. During all this cycling (8 parallel instructions to the
parallel port), data bit 2 has yet to go high. Circuitry can be designed
to sense and respond differently to these frequency differences. I merely
offer a means by which to control a large number of LEDs from a single
8 bit parallel port.

I'd like to stop here and see how you answer my questions and how
you and others in here respond to my frequency and 555 timer ideas.


Dominic
 
D

Dominic-Luc Webb

Of course, you could have some kind of 16 bit register 8 bits
at a time. I need to head home and would have to think on this.
I think there are a lot of people in here that know how to do
this better than me.

Dominic
 
J

John Fields

I'd like to stop here and see how you answer my questions and how
 
S

Si Ballenger

Hi All,

I'm trying to control hundreds of LEDs from my parallel port (8 data
pins - will soon be replaced with the output of a programmed PIC, also 8
pins).

I'm not an electronics guy (I'm a software developer), so trying to
control x00's of LEDs from 8 pins looks a bit tricky...

There's no way to change them all at the same time, so I reckon I'll
need some sort of "addressing" system. Using some of the pins to select
which LED I'm controlling, and one for the data.

Trouble is, even using 7 bits as the "address", I've only got 128
channels, but I imagine I'd need a bit for "send" too, so I can set the
address and the data, then have it read in one go.

What are my options? And what components would I need to achieve
something like this (I imagine right down at the end, I'll need a number
of registers for the LEDs. If these come in chips with 8 output legs, I
guess I'll need 38 for 300 LEDs. The bit between my 8 data pins and the
computer isn't my area though, so I'm stuck!

Oh, and this is just a hobby thing, so the cheaper the better. I'm sure
I can already buy scrolling screens, but I don't have the money, and I
want the fun of building one! :)

The below link has some info on individually controlling 320
christmas light strings via the parallel port. These could just
as well be LEDs. To turn on/off an LED will probably take an NPN
transistor and two resistors per LED instead of using a relay.
You've actually got 12 pins on the parallel port to work with.
The bottom links are some pages I've made with some simple
parallel port setups. I like tinkering with the 74HCT259 chips,
as they demultiplex and also latch, and cost only $.40 each. You
could use the 4 control pins to select the 259 chip pin and set
high/low, and the 8 data pins to control other 259 chips that
would individually clock the selected 259 chips. Get a couple
chips working as a test, then expand from there.

http://computerchristmas.com/index.phtml?link=how_to&HowToId=4

http://www.geocities.com/zoomkat/output.htm
http://www.geocities.com/zoomkat/ppswitcher.htm
http://www.geocities.com/zoomkat/status.htm
http://www.geocities.com/zoomkat/files/zoomkat-lpt.txt
 
D

Danny T

John said:
What _exactly_ do you want to do?

I want to created an led text display (like in the doctors waiting
room!). There's no real reason, I'm just toying around with things (got
a PIC Programmer coming this week) to see how different things can be
achieved (such as sending data to a large number of objects, without a
connection to everyone), for my master plan to take over the world :)
 
D

Danny T

Dominic-Luc Webb said:
May I ask if you can take advantage of any of the status bits?

This is entirely possible. I've never played with the parallel port
before, so my first step today was to connect the 8 data pins up to
LEDs, all connected back to port 25 (ground) and see if I could send
data. (this worked - I have tacky dancing lights!)

I didn't touch the status ports, because I wasn't entirely sure if I
could use them in the same way as the data pins, or if they're
"special". Currently I'm using a horrible interop DLL (I'm writing
managed .NET code in C#) and writing to the dataports is simply a call like:

Output(888, 0); // All off
Output(888, 255); // All on

888 being the address of pin1. If I change this number, I don't know
what will happen - maybe the status ports are the same, maybe not. I'll
look it up tomorrow when I'm a little more awake :)

Is there any pattern to how the LEDs are turned on and off? Are there
groups that can bit always be lit simultaneously or must they all be
controlled independently?

All independant. I want a text scroller, but my point of the exercise is
to see how it's possible to control lots of things from less pins.
Eventually, I want to be controlling a little robot or something, which
will consist of motors, steering etc.. The more things I learn before
then, the easier it'll be!

Maybe some can be lit up sequentially? In this case, maybe a 555 timer
connected to a counter series could reduce the number of permutations
required of the parallel port.

This wouldn't work for scrolling text, where I'd need to control all
LEDs to show a "frame", wait for a sec, then rewrite them all (possibly
shifted horizontally by one) for the next frame. It might be possible to
do something clever if they're all just shifted in rows, but I'd rather
have the flexibility of a full animated display, not just scrolling.

The parallel port data bits can be made to go high and low at different
frequencies. I believe it operates at 8 Mhz, but at any given moment,
it should be possible to dictate which pins go high and low. By cycling
back and forth, you create on/off states with frequencies you can choose
by software. If you are willing/able to build a frequency detecting
circuit, this could buy you a lot of additional permutations.

By frequency, do you mean the rate at which I'm turning the data pins
"on and off" (+5v / 0v)?

Consider the following set of bits I used to operate 4 stepper motors
that needed to turn at different speeds (I'll show 2 of the motors).
First bit indicates forward or reverse, while 2nd bit indicates step
or no step.

Motor 1 (data bits 0 and 1)
00
00
00
11
00
00
00
11


Motor 2 (data bits 2 and 3)
01
00
01
00
01
00
01


What my software sent out for the first bits:

0001
0000
0001
1100
0001
0000
0001
1100


Note that data bits 0 and 1 are cycling at twice the frequency as
data bit 3. During all this cycling (8 parallel instructions to the
parallel port), data bit 2 has yet to go high. Circuitry can be designed
to sense and respond differently to these frequency differences. I merely
offer a means by which to control a large number of LEDs from a single
8 bit parallel port.

I'd like to stop here and see how you answer my questions and how
you and others in here respond to my frequency and 555 timer ideas.

I'm a little confused by your example. What your software sent - is this
8 x 4bit signals, or are you sending 4 signals across all 8 pins?
If the first, then you're using 2 bits per motor, but I don't have the
luxury of enough bits for each LED. If the second, I don't udnerstand
how your motor would know which singals sent are for it, and not the other?

Thanks,

Danny
 
D

Danny T

Si said:

Was just looking at the datasheet for this - I think it'll do exactly
what I want! Will need a lot of them hooked together though, and with
the 3 input pins of some being attached to output pins of others, it's
going to be a bit fiddly on the software side!

Can I just make sure I understand this correct...

Using the 3 input pins, I choose which output I'm modifying (a binary
value of 0 to 8), and send the input on the input pin. Then I clock(?)
the "latch" pin, which copies the input state to the output pin I
addressed, and then holds it at that until I change again?

So to set the output bits alternating, with 1 being on, 2 off, 3 on
etc., I'd do something like:

1-3 = address
4 = input
1 2 3 4
0 0 0 1
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 1
etc. But with flashing the "latch" pin on and off in between each?

It'd vertainly work, but with so much addressing, isn't it going to take
seconds to do each frame? :-\

Thanks,

Danny
 
R

Robert Monsen

Danny said:
I want to created an led text display (like in the doctors waiting
room!). There's no real reason, I'm just toying around with things (got
a PIC Programmer coming this week) to see how different things can be
achieved (such as sending data to a large number of objects, without a
connection to everyone), for my master plan to take over the world :)

One easy way to extend the number of ports on a PIC is to use serial-in
parallel-out shift registers. The 4094 is a good example. You set up a
port pin to a value, then 'clock it in' to the 4094 using another port.
Once you have all 8 bits clocked in, you 'strobe' the data out to the
outputs. Thus, 3 port pins controls 8 outputs.

You can also 'daisy chain' these parts, since they have a serial-out pin
as well. Thus, you can string together a few of them.

Doing 2d arrays of LEDs can also be done by flashing them on a line at a
time. You divide the lights up into rows and columns, set up the row
values for a particular column, then flash it on for a while. By doing
this faster than the eye can follow (say 1/100 of a second for each
column) it looks like they are all being controlled independently.
However, it takes far fewer bits (40 for a 32x8 array of 256 LEDs).
That's doable with 5 of the shift registers above, and a few milliSMOPS.

--
Regards,
Robert Monsen

"Your Highness, I have no need of this hypothesis."
- Pierre Laplace (1749-1827), to Napoleon,
on why his works on celestial mechanics make no mention of God.
 
D

Dmitri

Danny T wrote:

I'm trying to control hundreds of LEDs from my parallel port (8 data
pins - will soon be replaced with the output of a programmed PIC, also
8
pins).
Oh, and this is just a hobby thing, so the cheaper the better. I'm sure
I can already buy scrolling screens, but I don't have the money, and I
want the fun of building one! :)

Speaking of the scrolling screens, you may want to use the same approach:
use specialized LED controller ICs. Maxim makes a whole line of such
devices (so do other people).
Check out this page at maxim's website:
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/1339
This is only one device of the product line. It controls up to 64
individual LEDs, and can be daisy-chained. You may want to browse through
links on that page to other ICs to see if there is one that suits you
better. Make sure you read through the application notes, they are a
tremendous source of information that pertains to what you are trying to
do, regardless of whether or not you will end up using Maxim's IC.

This IC runs for $10.81 at Digi-Key, but you can also request a sample
from Maxim to play with it and see if it works for you.

--
Dmitri Abaimov, RCDD
http://www.cabling-design.com
Cabling Forum, color codes, pinouts and other useful resources for
premises cabling users and pros
http://www.cabling-design.com/homecabling
Residential Cabling Guide
-------------------------------------


##-----------------------------------------------##
Article posted with Cabling-Design.com Newsgroup Archive
http://www.cabling-design.com/forums
no-spam read and post WWW interface to your favorite newsgroup -
sci.electronics.basics - 8162 messages and counting!
##-----------------------------------------------##
 
J

John Fields

I want to created an led text display (like in the doctors waiting
room!). There's no real reason, I'm just toying around with things (got
a PIC Programmer coming this week) to see how different things can be
achieved (such as sending data to a large number of objects, without a
connection to everyone), for my master plan to take over the world :)

---
Good plan, it worked for me!^)

Probably a good place to start is by defining the size of the
characters you want to display, and a 5X7 matrix works nicely unless
you want to get fancy, so what I'd do if it was me would be to set up
my display with seven rows of LEDs, and if you want to use about 300
LEDs that comes out to 300/7 = 42.857 columns. If each character is
five LEDs wide and you have a couple of LEDs separation between
characters that's a total of seven columns of LEDs per character, so
if you had six characters that would be 42 columns times seven rows
of LEDs = 294 LEDs. Not bad.

Now, to drive the LEDs I'd use garden variety 8 bit serial-in
parallel-out shift registers like XX164's configured as seven rows of
six shift registers per row, like this:


D7>---|SR]--[SR]--[SR]--[SR]--[SR]--[SR]

D6>---[SR]--[SR]--[SR]--[SR]--[SR]--[SR]

D5>---[SR]--[SR]--[SR]--[SR]--[SR]--[SR]

D4>---[SR]--[SR]--[SR]--[SR]--[SR]--[SR]

D3>---[SR]--[SR]--[SR]--[SR]--[SR]--[SR]

D2>---[SR]--[SR]--[SR]--[SR]--[SR]--[SR]

D1>---[SR]--[SR]--[SR]--[SR]--[SR]--[SR]


And I'd hook them up like this:

6 shift registers--->

7 shift registers
|
|
V



VCC>------+--+--+--+--+--+--+--+----------+--+--+--+--+--+--+--+--->
| | | | | | | | | | | | | | | |
[1][2][3][4][5][6][7][8]<-LEDs->[1][2][3][4][5][6][7][8]
| | | | | | | | | | | | | | | |
[R][R][R][R][R][R][R][R] [R][R][R][R][R][R][R][R]
| | | | | | | | | | | | | | | |
| | | | | | | +-----+ | | | | | | | +--->
| | | | | | | | | | | | | | | | |
+-+--+--+--+--+--+--+--+--+ | +-+--+--+--+--+--+--+--+--+
| Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7 | | | Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7 |
D7>---+-|Da,Db | +--|Da,Db |
| | | |
| | | |
D0>-+---|CLK | +---|CLK |
| |___ | | |___ |
Dn>---+-|CLR | | +-|CLR |
| | +-------------------------+ | | +-------------------------+
| +-----------------------------|-+----------------------------->
+-|-----------------------------+------------------------------->|
| |
| | Vcc
| | |
| | +--+--+--+--+--+--+--+----------+--+--+--+--+--+--+--+--->
| | | | | | | | | | | | | | | | | |
| | [1][2][3][4][5][6][7][8]<-LEDs->[1][2][3][4][5][6][7][8]
| | | | | | | | | | | | | | | | | |
| | [R][R][R][R][R][R][R][R] [R][R][R][R][R][R][R][R]
| | | | | | | | | | | | | | | | | |
| | | | | | | | | +-----+ | | | | | | | +--->
| | | | | | | | | | | | | | | | | | |
| | +-+--+--+--+--+--+--+--+--+ | +-+--+--+--+--+--+--+--+--+
| | | Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7 | | | Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7 |
D6>-|-|-|Da,Db | +--|Da,Db |
| | | | | |
| | | | | |
+-|-|CLK | +---|CLK |
| | |___ | | |___ |
| +-|CLR | | +-|CLR |
| | +-------------------------+ | | +-------------------------+
| +-----------------------------|-+----------------------------->
+-------------------------------+------------------------------->

If you used high efficiency 2mA LEDs you could use HC164s, but if you
used regular 20mA LEDs you'd be better off running them at 10ma and
using LS164s.

The way the thing works is that you'd present a parallel 7 bit data
word to the serial data inputs of the first shift registers on each
row, then hit all the shift registers with the same clock. That would
move the seven data bits into column 1. Then you'd get the next 7 bit
word and clock it into the serial inputs. That would move the new
data into column 1 and move what was in column 1 to column 2. As you
kept on loading and clocking data into the array the columns would
scroll horizontally and you'd see your characters scrolling by. I've
shown the CLEAR activated by logic, but if you don't have a line to do
that with, just load ones into the serial inputs and clock them
through. The logic for the characters is negative true; that is, if
you want an LED to light up send a zero. If you want to do it the
other way, just reverse the polarity of the LEDs and connect them to
ground, but only if you use high efficiency LEDs driven by HC. LS
won't source enough current to make either high efficiency or regular
20mA LEDs light up nicely.
 
C

CFoley1064

Subject: Controlling hundreds of LEDs
From: Danny T [email protected]
Date: 12/21/2004 11:41 AM Central Standard Time
Message-id: <[email protected]>

Hi All,

I'm trying to control hundreds of LEDs from my parallel port (8 data
pins - will soon be replaced with the output of a programmed PIC, also 8
pins).

I'm not an electronics guy (I'm a software developer), so trying to
control x00's of LEDs from 8 pins looks a bit tricky...

There's no way to change them all at the same time, so I reckon I'll
need some sort of "addressing" system. Using some of the pins to select
which LED I'm controlling, and one for the data.

Trouble is, even using 7 bits as the "address", I've only got 128
channels, but I imagine I'd need a bit for "send" too, so I can set the
address and the data, then have it read in one go.

What are my options? And what components would I need to achieve
something like this (I imagine right down at the end, I'll need a number
of registers for the LEDs. If these come in chips with 8 output legs, I
guess I'll need 38 for 300 LEDs. The bit between my 8 data pins and the
computer isn't my area though, so I'm stuck!

Oh, and this is just a hobby thing, so the cheaper the better. I'm sure
I can already buy scrolling screens, but I don't have the money, and I
want the fun of building one! :)
Subject: Re: Controlling hundreds of LEDs
From: Danny T [email protected]
Date: 12/21/2004 3:22 PM Central Standard Time
Message-id: <[email protected]>


Someone in sci.electronics.basics suggested 74HCT259. Looking at them
both (I'm not that familiar with geek-speak in datasheets!), is the main
difference that one uses 3 bits for addressing, while the other
increments the bit I'm modifying using a single pin?



But to control 38, I'll need another 5, right? So my parallel port
controls 5, which control the 38, attached to the LEDs?

I don't understand what you mean by "One IC for every 8 LEDs (which can
be driven directly, source or sink, with only one series resistor per LED)"

Directly, source or sink?

As for resistors, I'm currently running the LEDs directly from 5V on my
parallel port. Would the chip not output a similar voltage, and hook up
straight to the LED?



While Googling earlier, I found lots of references to "demultiplexing",
but couldn't figure out what on earth it was. The context seems to
suggest it might help, but even google didn't link to dictionary.com for
it :-(



Yeah, I posted there too, unsure exactly which was best. Had good
answers from both. Thanks :)

Danny
<continued from s.e.d.>

Hi, Danny. The 'HC595 is a serial input, parallel output IC. You output the
data one bit at a time (Data In). After every bit, you toggle the clock active
(CLK), then inactive to shift the data bit one further down the line. You then
present the next bit of data, clock again, and so on. After all the bits are
shifted in, you toggle the Latch pins active, then inactive to present all the
data that has been shifted into the ICs, one bit at a time, to the output pins
of the ICs.

Your hookup will go something like this (view in fixed font or M$ Notepad):


D2 o----o--------------------------o-------------------------o-------
| | |
D1 o--o--------------------------o-------------------------o---------
| | VCC | | VCC | |
| | + | | + | |
| | | | | | | |
| | .--------o----------. | | .---------o---------. | | .-----
| | | RST | | | | RST | | | |
| '-oLatch | | '-oLatch | | '-oLatch
| | | | | | | |
'---oCLK HC595 | '---oCLK HC595 | '---oCLK
| | | | |
| | | | |
D0 o------oData In SQ8o------oData In SQ8o-----oData
| 1 2 3 4 5 6 7 8 | | 1 2 3 4 5 6 7 8 | | 1
'--o-o-o-o-o-6-o-o--' '--o-o-o-o-o-o-o-o--' '----o
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

No matter how many of the '595s you have chained together, you'll only need the
3 printer/PIC port output pins, D0, D1, and D2 (with the caveat about buffering
mentioned above).

If you're still not clear on the concept, google "serial shift register".

By the way, you need a 5V power supply that you have to connect to each IC pin
16 (+) and 8 (-), like it says on the data sheet.

<quote>
Another quick (possibly dumb) question...

If you go to www.rswww.com (the URL has a session ID, so prob won't
work!) and search for the 74HC595, and click through to the product
page, it lists several:

MC74HC595AN
SN74HC595N
74HC595D

but I don't understand the differences between them (there's a hefty
price difference!). What am I missing?
<unquote>

Go with the HC595N. The "D" is a SMT package. I believe the "AN" is an
extended temp range IC.

A scrolling LED alphanumeric display is a tall order. Each character will
require a minimum of 35 LEDs (5X7), plus you'll need a line below and a line
between, which means 48 LEDs per character. And if you want scrolling and
animation, serial shift registers may be too slow (although not for 6
characters).

You need to decide what you can do and what you can afford. Here's a good rule
of thumb: at 300 LEDs (about 6 to 8 characters), you'll spend more than twice
as much on the LEDs as the ICs, If you have more like 3000 LEDs, serial won't
cut it. For that, the LEDs will be a large majority of the price. Decide what
you want to do and what you can afford, and go from there (hobbyist LEDs, and
5X7 LED displays, are available at hobbyist prices at jameco.com).

Chris
 
S

Si Ballenger

Was just looking at the datasheet for this - I think it'll do exactly
what I want! Will need a lot of them hooked together though, and with
the 3 input pins of some being attached to output pins of others, it's
going to be a bit fiddly on the software side!

Can I just make sure I understand this correct...

Using the 3 input pins, I choose which output I'm modifying (a binary
value of 0 to 8), and send the input on the input pin. Then I clock(?)
the "latch" pin, which copies the input state to the output pin I
addressed, and then holds it at that until I change again?

In the latching mode (used to control the individual LEDs), you
use the A0, A1, and A2 input pins to select the chip output pin
you want to set high or low. You set the D data pin on the chip
at 0v for the chosen output pin to output 0v, or set the D pin to
+5v for the output pin to output +5v. Then you clock the LE pin
with +5v to latch the output pin in the desired state (0v or
+5v). The same A0, A1, A2, and D control lines can be connected
to all the 259 chips. You clock the LE input on the individual
chip you want to control. The As and the D can be done using four
of the output pins on the parallel port. The other parallel port
pins can be used for clocking theindividual chips You can use two
of the 259 chips in the demultiplex mode to clock the individual
259 chips used in the latching mode. Using the eight parallel
port data pins and 17 259 chips (2 in demultiplex and 15 in latch
mode), you could individually control 120 LEDs. The output page
below shows the latching mode schematic, and the ppswitcher3 page
shows the chips in the demultiplex mode. If you used the parallel
port control and data pins, this number could be multiplied many
times.

http://www.geocities.com/zoomkat/output.htm
http://www.geocities.com/zoomkat/ppswitcher3.htm

Using parallel port data pins 0, 1, and 2 to control the As, pin
3 for D, and pin 4 for the LE clock on a chip, here are the byte
sequences to turn Q7 on and off:

00001111 sets all As high (Q7) and the D high for +5v output
00011111 clocks the chip LE pin high
00001111 drops the LE pin low to latch Q7 at +5v output

00000111 sets all As high (Q7) and the D low for 0v output
00010111 clocks the chip LE pin high
00000111 drops the LE pin low to latch Q7 at 0v output
 
D

Danny T

Robert said:
One easy way to extend the number of ports on a PIC is to use serial-in
parallel-out shift registers. The 4094 is a good example. You set up a
port pin to a value, then 'clock it in' to the 4094 using another port.
Once you have all 8 bits clocked in, you 'strobe' the data out to the
outputs. Thus, 3 port pins controls 8 outputs.

You can also 'daisy chain' these parts, since they have a serial-out pin
as well. Thus, you can string together a few of them.

Doing 2d arrays of LEDs can also be done by flashing them on a line at a
time. You divide the lights up into rows and columns, set up the row
values for a particular column, then flash it on for a while. By doing
this faster than the eye can follow (say 1/100 of a second for each
column) it looks like they are all being controlled independently.
However, it takes far fewer bits (40 for a 32x8 array of 256 LEDs).
That's doable with 5 of the shift registers above, and a few milliSMOPS.

Sounds easy... But - milliSMOPS? Are you having a laugh? Google doesn't
know what they are either! :p
 
D

Danny T

CFoley1064 said:
Hi, Danny. The 'HC595 is a serial input, parallel output IC. You output the
data one bit at a time (Data In). After every bit, you toggle the clock active
(CLK), then inactive to shift the data bit one further down the line. You then
present the next bit of data, clock again, and so on. After all the bits are
shifted in, you toggle the Latch pins active, then inactive to present all the
data that has been shifted into the ICs, one bit at a time, to the output pins
of the ICs.

Your hookup will go something like this (view in fixed font or M$ Notepad):


D2 o----o--------------------------o-------------------------o-------
| | |
D1 o--o--------------------------o-------------------------o---------
| | VCC | | VCC | |
| | + | | + | |
| | | | | | | |
| | .--------o----------. | | .---------o---------. | | .-----
| | | RST | | | | RST | | | |
| '-oLatch | | '-oLatch | | '-oLatch
| | | | | | | |
'---oCLK HC595 | '---oCLK HC595 | '---oCLK
| | | | |
| | | | |
D0 o------oData In SQ8o------oData In SQ8o-----oData
| 1 2 3 4 5 6 7 8 | | 1 2 3 4 5 6 7 8 | | 1
'--o-o-o-o-o-6-o-o--' '--o-o-o-o-o-o-o-o--' '----o
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

No matter how many of the '595s you have chained together, you'll only need the
3 printer/PIC port output pins, D0, D1, and D2 (with the caveat about buffering
mentioned above).

Right, I think I understand - except for what you've labelled as SQ8 on
your diagram. Does this hold the "last" bit that's about to be dropped?
(and does this work based on the clock pin, and not the latch?) So if I
sent 16 bits (clocking active in between each), and *then* latch, would
I get 16 unique outputs, which I can then redraw before the next latch?

Think this will be the easiest way, though I don't know how fast I can
shift the data (300 LEDs is more than 600 outputs)!

Thanks,

Danny
 
D

Danny T

CFoley1064 said:
Go with the HC595N. The "D" is a SMT package. I believe the "AN" is an
extended temp range IC.

The AN is half the price! I was just checking the "Technical Info" PDFs
on rswww, and I can't find any difference (in temp, or anything else) :-\
 
D

Dominic-Luc Webb

All independant. I want a text scroller, but my point of the exercise is
to see how it's possible to control lots of things from less pins.
Eventually, I want to be controlling a little robot or something, which
will consist of motors, steering etc.. The more things I learn before
then, the easier it'll be!


I am busy at work and may need to put off most of my answers until later.
If you are going with a scrolling display, then a serial to parallel type
of IC is a good start, but it depends very much on how many LEDs you want
to control. I could suggest considering exactly what the dimensions of the
display will be and letting this dictate design requirements. I think this
reflects real world engineering.

I could for instance consider using the serial to parallel IC only to
control the vertical axis of the very last LEDs at the right end. You should
be able to control many of these with a serial to parallel IC. Since you have
a scrolling text, all of the status of the LEDs left of the very first
LEDs are dictated by the status of the LEDs on the right end. All
subsequent LEDs can be lit by activating a 555 timer IC whose output is
connected to a counter IC. Each step of the counter activates the next
LED to the left of the preceding LED. Each preceding LED turns off. This
in principle can very cheaply and efficiently control many hundreds (even
thousands) of LEDs.

My example showing the data bits shows only the first 4 of the 8 data
pins as this is all that is actually required to drive two stepper motors,
one pin dictates forward or reverse, and one pin dictates step or no step.
4 pins therefore can control two motors.


Dominic
 
C

CFoley1064

Subject: Re: Controlling hundreds of LEDs
From: Danny T [email protected]
Date: 12/22/2004 4:54 AM Central Standard Time
Message-id: <[email protected]>
Right, I think I understand - except for what you've labelled as SQ8 on
your diagram. Does this hold the "last" bit that's about to be dropped?
(and does this work based on the clock pin, and not the latch?) So if I
sent 16 bits (clocking active in between each), and *then* latch, would
I get 16 unique outputs, which I can then redraw before the next latch?

Think this will be the easiest way, though I don't know how fast I can
shift the data (300 LEDs is more than 600 outputs)!

Thanks,

Danny

If you've got an 8-bit shift register, what happens when you shift in the 9th
bit? The joke is, "It falls into the Bit Bucket, of course", meaning it
disappears out the end. Seriously, if you've got a line of serial data, you
can chain 8-bit shift registers so the first bit is shifted into the second IC
when the 9th bit is shifted in. It's a simple shift register concept, and the
SQ8 pin on the '595 is where you either put the bit bucket (;-) or you put
another shift register IC.

If you're doing 5X7 matrix displays, you don't have access to all 70 LED pins
anyway. You have to address them as row/column. If you do it that way, you
will minimize the shift register outputs. But, like the professional displays,
you then have to be concerned about a multiplexing setup where you use
persistence of vision to go across the columns fast enough that they don't
appear to flicker.

I've been following the flurry of posts here, and it seems like you've got a
ways to go on your understanding of the hardware end of things. If you want to
do a project over the holidays, possibly you might want to consider a smaller
concept (like one alphanumeric character display) until your hardware
capabilities catch up to your software skills.

Good luck
Chris
 
D

Danny T

CFoley1064 said:
If you've got an 8-bit shift register, what happens when you shift in the 9th
bit? The joke is, "It falls into the Bit Bucket, of course", meaning it
disappears out the end. Seriously, if you've got a line of serial data, you
can chain 8-bit shift registers so the first bit is shifted into the second IC
when the 9th bit is shifted in. It's a simple shift register concept, and the
SQ8 pin on the '595 is where you either put the bit bucket (;-) or you put
another shift register IC.

Thought so. Looks like a nice (*cough* easy) way to do what I want!

I've been following the flurry of posts here, and it seems like you've got a
ways to go on your understanding of the hardware end of things. If you want to
do a project over the holidays, possibly you might want to consider a smaller
concept (like one alphanumeric character display) until your hardware
capabilities catch up to your software skills.

First thing is to build my PIC Programmer - if I don't get past that... ;-)

I wasn't planning on jumping right into anything, just wanted to make
sure any smaller "test cases" are headed in the right direction, and not
that I learn to control 15 LEDs and then someone says "that'll never
work for more than 20"!

Thanks for your help (and everyone else). I've learnt a lot before I've
even started fiddling with hardware :)

Danny
 
Top