Using Allegro UCN 5832 32-bit driver w/BS2SX
Archiver
Posts: 46,084
I took the code that tracy@e... (Tracy Allen) left for someone who
was trying to use the allegro 5833 and tried to adapt it to my 5832. It
seemed pretty straightforward, so maybe that's why I'm confused!
My output enable pin is always high.
When I send 1s, my 5832 output pin seems to be low and when I send 0s, the
output seems to be high. I thought that if I sent 1s, the output would be
high and if I sent 0s, the output would be low.
Which is it? and if 1s should make it high, any ideas about why mine make
them low?
thanks
bob
Here's my code
the stamp pin 5 is connected to the 5832 pin 19 which is out 15
'{$STAMP BS2sx}
sdata con 15
sclk con 14
strobe con 12
input 5
x0 var word
x1 var word
initialize:
x0 = $ffff
x1 = $ffff
shiftout Sdata,Sclk,msbfirst,[noparse][[/noparse]x0\16,x1\16] ' send all 1's to UCN5832
high strobe ' activate
low strobe
high 7
debug bin ? x0
debug bin ? x1
debug ? in5
pause 1024 ' leave them ON for ~1 second
' now all lamps OFF, except "zero"
X0=%0000100001110000 ' light pattern, 1=ON
X1=%0000100001110000 ' light pattern, 1=ON
showdat:
shiftout Sdata,Sclk,msbfirst,[noparse][[/noparse]X0\16,x1\16] ' send light pattern to UCN5832
high strobe ' activate it
low strobe
debug bin16 ? x0
debug bin16 ? x1
debug ? in5
was trying to use the allegro 5833 and tried to adapt it to my 5832. It
seemed pretty straightforward, so maybe that's why I'm confused!
My output enable pin is always high.
When I send 1s, my 5832 output pin seems to be low and when I send 0s, the
output seems to be high. I thought that if I sent 1s, the output would be
high and if I sent 0s, the output would be low.
Which is it? and if 1s should make it high, any ideas about why mine make
them low?
thanks
bob
Here's my code
the stamp pin 5 is connected to the 5832 pin 19 which is out 15
'{$STAMP BS2sx}
sdata con 15
sclk con 14
strobe con 12
input 5
x0 var word
x1 var word
initialize:
x0 = $ffff
x1 = $ffff
shiftout Sdata,Sclk,msbfirst,[noparse][[/noparse]x0\16,x1\16] ' send all 1's to UCN5832
high strobe ' activate
low strobe
high 7
debug bin ? x0
debug bin ? x1
debug ? in5
pause 1024 ' leave them ON for ~1 second
' now all lamps OFF, except "zero"
X0=%0000100001110000 ' light pattern, 1=ON
X1=%0000100001110000 ' light pattern, 1=ON
showdat:
shiftout Sdata,Sclk,msbfirst,[noparse][[/noparse]X0\16,x1\16] ' send light pattern to UCN5832
high strobe ' activate it
low strobe
debug bin16 ? x0
debug bin16 ? x1
debug ? in5
Comments
is correct: A "1" drives the output LOW, that is, turns it ON. If
you want the opposite, you just have to send ~x instead of x. ("~"
is stampese for NOT). I'm not up on the differences between the
'5833 and the '5832.
-- Tracy
>I took the code that tracy@e... (Tracy Allen) left for someone who
>was trying to use the allegro 5833 and tried to adapt it to my 5832. It
>seemed pretty straightforward, so maybe that's why I'm confused!
>
>My output enable pin is always high.
>
>When I send 1s, my 5832 output pin seems to be low and when I send 0s, the
>output seems to be high. I thought that if I sent 1s, the output would be
>high and if I sent 0s, the output would be low.
>
>Which is it? and if 1s should make it high, any ideas about why mine make
>them low?
>
>thanks
>
>bob
>
>Here's my code
>
>the stamp pin 5 is connected to the 5832 pin 19 which is out 15
>
>'{$STAMP BS2sx}
>
>sdata con 15
>sclk con 14
>strobe con 12
>input 5
>x0 var word
>x1 var word
> initialize:
>
>x0 = $ffff
>x1 = $ffff
>
> shiftout Sdata,Sclk,msbfirst,[noparse][[/noparse]x0\16,x1\16] ' send all 1's to UCN5832
> high strobe ' activate
> low strobe
>high 7
>debug bin ? x0
>debug bin ? x1
>debug ? in5
> pause 1024 ' leave them ON for ~1 second
> ' now all lamps OFF, except "zero"
> X0=%0000100001110000 ' light pattern, 1=ON
> X1=%0000100001110000 ' light pattern, 1=ON
> showdat:
> shiftout Sdata,Sclk,msbfirst,[noparse][[/noparse]X0\16,x1\16] ' send light pattern to UCN5832
> high strobe ' activate it
> low strobe
>debug bin16 ? x0
>debug bin16 ? x1
>debug ? in5
>
>
>
>To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
>from the same email address that you subscribed. Text in the
>Subject and Body of the message will be ignored.
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
No, you don't need a 2.7 volt power supply. You should connect each
LED with a resistor in series with it to limit the current. There
are tutorials about how to calculate the resistor value on the
Parallax web site, and elsewhere. Al William's web site. Or in
those little books available at radio shack stores.
5833 pin --|<
/\/\----+5 volts
led resistor
The led turns on when the 5833 pin goes LOW, sinking current. You
might want to get 10 milliamps through the led. If 2 volts is
dropped by the LED, and 0.8 volt by the 5833 pin, that leaves 2.2
volts to be dropped by the resistor. 2.2volts/0.010 amp = 220
ohms. It is not critical. Anything from 100 to 1000 ohms will work,
depending on the brightness you want. All the lights can add up to
quite a bit of current from the 5 volt supply, so watch out for that.
-- Tracy
>Tracy,
>
>thanks for the clarification. I guess my naivete shows because I would think
>of a HIGH output being ON. oh well.
>
>I don't want to be too much of a pest, but I'll push you a little further [noparse]:)[/noparse]
>I want to use these devices to control a bank of LEDs for an art project.
>The least expensive kinds of LEDs seem to want about 2.7 volts. It appears
>that the voltage delivered here when high is 5 volts, the same as the input
>to keep it powered.
>
>If I could find a 2.7 volt power supply, could I connect it to the high side
>of my LED to make this work? Then, when the 5832 was actually high, the
>differential across the LED would be the wrong way and nothing would happen,
>but when it went low, I'd have the right power?
>
>If so, any ideas on where to find a 2.7 volt power supply or directions on
>how to build one?
>
>thanks so much
>
>bob roan
>
>In a message dated 02/11/2003 10:11:08 AM Pacific Standard Time,
>tracy@e... writes:
>
>> The '5833 is an inverting open collector driver, and your observation
>> is correct: A "1" drives the output LOW, that is, turns it ON. If
>> you want the opposite, you just have to send ~x instead of x. ("~"
> > is stampese for NOT). I'm not up on the differences between the
> > '5833 and the '5832.
> >
thanks for the advice. But wouldn't it be easier to get a power supply that
was the correct voltage and not have to add 100 extra resistors to my project?
bob
In a message dated 02/11/2003 3:15:36 PM Pacific Standard Time,
tracy@e... writes:
> Hi Bob,
>
> No, you don't need a 2.7 volt power supply. You should connect each
> LED with a resistor in series with it to limit the current. There
> are tutorials about how to calculate the resistor value on the
> Parallax web site, and elsewhere. Al William's web site. Or in
> those little books available at radio shack stores.
>
> 5833 pin --|<
/\/\----+5 volts
> led resistor
>
> The led turns on when the 5833 pin goes LOW, sinking current. You
> might want to get 10 milliamps through the led. If 2 volts is
> dropped by the LED, and 0.8 volt by the 5833 pin, that leaves 2.2
> volts to be dropped by the resistor. 2.2volts/0.010 amp = 220
> ohms. It is not critical. Anything from 100 to 1000 ohms will work,
> depending on the brightness you want. All the lights can add up to
> quite a bit of current from the 5 volt supply, so watch out for that.
>
> -- Tracy
>
Well, LEDs are not like ordinary light bulbs, which gradually get
brighter as you gradually increase the voltage. Instead, LEDs have a
threshold voltage and it doesn't take much above/below that threshold
to go from no light at all to burning it out. The current through
the LED has to be controlled, and the resistor does that. While you
probably could get it to work by leaving out the resistors and
carefully adjusting the voltage upward, it would not be very stable.
You would find variation among the LEDs, where some are already
bright while others in your array are still dim. That occurs because
of variation in the threshold voltage among LEDs, especially if they
are different colors or if they come from different manufacturers or
different batches.
The resistor sets the current in milliamps through the LED. Think of
lighting an LED with milliamps, not volts! Light intensity is nearly
proportional to current.
Another popular led driver chip is the 24-pin MAX7219, which can
drive 64 LEDs hooked up as 8 rows and 8 columns, instead of one pin
to one LED. That chip has built-in current limiting, so you wouldn't
need external resistors.
http://www.parallax.com/html_pages/downloads/bsaccessories/documentati
on_accessories.asp
Look for the free documentation for the Parallax 7219 Appkit. I'm
not sure if Parallax still sells the part and the appkit.
-- Tracy
>Tracy,
>
>thanks for the advice. But wouldn't it be easier to get a power supply that
>was the correct voltage and not have to add 100 extra resistors to my project?
>
>bob
> > Hi Bob,
> >
> > No, you don't need a 2.7 volt power supply. You should connect each
> > LED with a resistor in series with it to limit the current. There
> > are tutorials about how to calculate the resistor value on the
> > Parallax web site, and elsewhere. Al William's web site. Or in
> > those little books available at radio shack stores.
> >
> > 5833 pin --|<
/\/\----+5 volts
> > led resistor
> >
> > The led turns on when the 5833 pin goes LOW, sinking current. You
> > might want to get 10 milliamps through the led. If 2 volts is
> > dropped by the LED, and 0.8 volt by the 5833 pin, that leaves 2.2
> > volts to be dropped by the resistor. 2.2volts/0.010 amp = 220
> > ohms. It is not critical. Anything from 100 to 1000 ohms will work,
> > depending on the brightness you want. All the lights can add up to
> > quite a bit of current from the 5 volt supply, so watch out for that.
> >
> > -- Tracy
>
a 40-pin DIP part with open-collector outputs which can directly sink
current for 32 outputs. 10 mA x 32 LED's is 320 mA, just for LED
lighting, AND each LED needs its own limiting resistor. (Note they
make SIP and DIP format resistors, which take up less space). A more
typical approach with this many LED's is to 'scan' them -- cycle
power to each of the whole set of LED's at a high enough rate that
there is no visible 'flicker'. This takes less power than lighting
them all the time.
The UCN5832 doesn't do this scan by itself, and you don't want to
dedicate your Stamp to LED scan. The MAXIM 7219 is set up to do this
scan itself for 64 LEDs wired in an array, with one limiting resistor
for the whole set. Simpler wiring, fewer components, and less
power. Depending on price, this may be the way to go.
Plus, you have these wonderful Parallax examples of how to do it.
--- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
> Hi Bob,
>
> Well, LEDs are not like ordinary light bulbs, which gradually get
> brighter as you gradually increase the voltage. Instead, LEDs have
a
> threshold voltage and it doesn't take much above/below that
threshold
> to go from no light at all to burning it out. The current through
> the LED has to be controlled, and the resistor does that. While
you
> probably could get it to work by leaving out the resistors and
> carefully adjusting the voltage upward, it would not be very
stable.
> You would find variation among the LEDs, where some are already
> bright while others in your array are still dim. That occurs
because
> of variation in the threshold voltage among LEDs, especially if
they
> are different colors or if they come from different manufacturers
or
> different batches.
>
> The resistor sets the current in milliamps through the LED. Think
of
> lighting an LED with milliamps, not volts! Light intensity is
nearly
> proportional to current.
>
> Another popular led driver chip is the 24-pin MAX7219, which can
> drive 64 LEDs hooked up as 8 rows and 8 columns, instead of one pin
> to one LED. That chip has built-in current limiting, so you
wouldn't
> need external resistors.
>
>
http://www.parallax.com/html_pages/downloads/bsaccessories/documentati
> on_accessories.asp
> Look for the free documentation for the Parallax 7219 Appkit. I'm
> not sure if Parallax still sells the part and the appkit.
>
> -- Tracy
>
>
>
>