Best chip to use with BS2px concerning control of multiple LED's
kingspud
Posts: 128
Hello all,
I am doing a project that must be able to control the HIGH/LOW state of 121 LEDs individually!
Since the BS2px has 16 I/O port I will need more help!!!
I could use the DM74LS48 = BDC to 7- Segment decoder·chip used for 7-segment displays but when you work the chain down I would need a total of...
45 chips!!!!· Ok, I don't know about you but I don't want to wire 45 Decoder chips!!
I tested a ONE-OF-TEN Decoder chip "74LS42" chip! But you can only have 1 LED turned off and the other 9 are all on!· I would have to first invert all the other connections to have all of them off and one left on!· yet this would still not allow me to control each of the 10 LEDS off of this chip!
So... question... does anyone know of a chip that would take 4 input and control more than 7 outputs!
The 121 LEDs are in a matrix of 11 by 11 and I need to be able to turn each one on or off and keep it that way while controlling the other LED's in the matrix.
I also need to map each of these states within a sequence!· Meaning... Each 121 LED's could be manipulated on or off and then saved!· Once saved you could bring up another grid to create another display sequence and so on...· Almost like a movie... where each 121 LED's are in a frame sequence and each frame is save to play in a movie sequence!· frame 1 then frame 2 then frame 3 and so on!!
You would be able to control the speed of each frame as they play one after the other.
So.... Does anyone out there is Basic Stamp land or Chip land know of any chips that I can use to control more than 7 LED
Thanks
Joe
I am doing a project that must be able to control the HIGH/LOW state of 121 LEDs individually!
Since the BS2px has 16 I/O port I will need more help!!!
I could use the DM74LS48 = BDC to 7- Segment decoder·chip used for 7-segment displays but when you work the chain down I would need a total of...
45 chips!!!!· Ok, I don't know about you but I don't want to wire 45 Decoder chips!!
I tested a ONE-OF-TEN Decoder chip "74LS42" chip! But you can only have 1 LED turned off and the other 9 are all on!· I would have to first invert all the other connections to have all of them off and one left on!· yet this would still not allow me to control each of the 10 LEDS off of this chip!
So... question... does anyone know of a chip that would take 4 input and control more than 7 outputs!
The 121 LEDs are in a matrix of 11 by 11 and I need to be able to turn each one on or off and keep it that way while controlling the other LED's in the matrix.
I also need to map each of these states within a sequence!· Meaning... Each 121 LED's could be manipulated on or off and then saved!· Once saved you could bring up another grid to create another display sequence and so on...· Almost like a movie... where each 121 LED's are in a frame sequence and each frame is save to play in a movie sequence!· frame 1 then frame 2 then frame 3 and so on!!
You would be able to control the speed of each frame as they play one after the other.
So.... Does anyone out there is Basic Stamp land or Chip land know of any chips that I can use to control more than 7 LED
Thanks
Joe
Comments
Look for a chip that does multiplexing. A 12x12 chip might be possible to find. Or could be made with an SX48 protoboard.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
COMING SOON "SD DATA LOGGER" www.sddatalogger.com
"I reject your reality, and substitute my own." Mythbusters
·
This would actually allow for a matrix of 16x16 (256 LED's)
Parallax Product Item
DataSheet
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Datasheet:
http://pdfserv.maxim-ic.com/en/ds/MAX7219-MAX7221.pdf
Nuts and Volts:
http://www.parallax.com/dl/docs/cols/nv/vol2/col/nv70.pdf
Parallax part:
http://www.parallax.com/detail.asp?product_id=603-00001
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
But... 1-wire has one flaw in this application, namely that it takes time to switch them one by one.
(normal bus-speed is 9600bps and with the need to send 8 Address Bytes and a command to each one you want to change the status on, add the Reset pulse and a bit of other stuff, and the speed soon drops)
You can switch all of them On or Off at the same time, though, with the 'Skip ROM' functionality, but still...
There's also the question of if you want to spend all that EEPROM space to store Serial numbers...
(8 Bytes each, or 6 if you keep in mind that one Byte is a 'type code' and never changes, and one is a CRC and can be calculated)
I'd go for the MAX7219, myself.
Two of them should be enough for the whole grid, but if you want to do it simple, you may want to use 4, so that you can more easily split it up into squares.
(A whole picture will then be sotred as either 16 or 32Bytes, depending on how many MAXes you use)
Even assuming that you 'record' complete 32Bytes 'pictures' and store them in a Program slot, you can get 64 such 'pictures' in one slot.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't visit my new website...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Parts list:
4049 inverter : 2
74AC16374 16 bit latch : 11 (for 11 x 11) 16 shown
74154 binary to 16 decoder : 1 outputs are low unless address is present. used as ROW 1-12 controller
Concept:
74154 turns on a single output based on 4 bit output from the controller(P12-P15). These outs on the 74154 are active low, so you have to invert them with 4049's. When an output is on, that "row" is written.
P0-P10 establishes which leds are on per a single row
P11 enables the 74154 and writes whatever row gets the output.
P12-P15 NIB that sets 74154 to proper address
This is the closest I can come to the smallest chip count, but it kills i/o's
I picked up two of the Max7219 chips but was wondering if any one has used this chip in conjunction with the BS2px or any other BS2 chip?
I would love to see some example programs with the BS2 chip controlling the MAX7219 chip!
When I get it I will test my program and see what works!
I plan on using an 8x8 Matrix displays first and see how the LED's function individually HIGH/LOW with my project scope!
Thanks
Joe
Have a look at the article in Nuts and Volts for an example:
http://www.parallax.com/dl/docs/cols/nv/vol2/col/nv70.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse
' Program: MAX7219.BS2
' This program controls the MAX7219 LED display driver. It demonstrates
' the basics of communicating with the 7219, and shows a convenient
' method for storing setup data in tables. To demonstrate practical
' application of the 7219, the program drives a 5-digit display to
' show the current value of a 16-bit counter (0-65535). The subroutines
' are not specialized for counting; they can display _any_ 16-bit
' value on the LCDs. (A specialized counting routine would be faster,
' since it would only update the digits necessary to maintain the
' count; however, it wouldn't be usable for displaying arbitrary
' 16-bit values, like the results of Pot, Pulsin, or an A-to-D
' conversion).
' Hardware interface with the 7219:
DATA_n con 7 ' Bits are shifted out this pin # to 7219.
CLK con 5 ' Data valid on rising edge of this clock pin.
Load con 6 ' Tells 7219 to transfer data to LEDs.
' Register addresses for the MAX7219. To control a given attribute
' of the display, for instance its brightness or the number shown
' in a particular digit, you write the register address followed
' by the data. For example, to set the brightness, you'd send
' 'brite' followed by a number from 0 (off) to 15 (100% bright).
decode con 9 ' Decode register; a 1 turns on BCD decoding.
brite con 10 ' " " " intensity register.
scan con 11 ' " " " scan-limit register.
switch con 12 ' " " " on/off register.
test con 15 ' Activates test mode (all digits on, 100% bright)
' Variables used in the program.
max_dat var word ' Word to be sent to MAX7219.
index var nib ' Index into setup table.
temp var nib ' Temporary variable used in outputting digits.
nonZ var bit ' Flag used in blanking leading zeros.
dispVal var word ' Value to be displayed on the LEDs.
odd var index.bit0 ' Lsb of index.
' The program begins by setting up all pins to output low, matching
' the state established by the pulldown resistors.
OUTS = 0 ' All output latches low.
DIRS = $FFFF ' All pins to output.
' Next, it initializes the MAX7219. A lookup table is convenient way
' to organize the setup data; each register address is paired with
' its setting data. The table sets the scan limit to 4 (5 digits,
' numbered 0-4); brightness to 3; BCD decoding to the lower 5 digits
' (the only ones we're displaying), and switches the display on. The
' MAX7219 expects data in 16-bit packets, but our lookup table holds
' a series of 8-bit values. That's why the loop below is designed to
' pulse the Load line _every_other_ byte transmitted.
for index = 0 to 7 ' Retrieve 8 items from table.
lookup index,[noparse][[/noparse]scan,4,brite,3,decode,$1F,switch,1],max_dat
shiftout DATA_n,CLK,msbfirst,[noparse][[/noparse]max_dat]
if odd = 0 then noLoad ' If odd is 1, pulse Load line.
pulsout Load,1
NoLoad: ' Else, don't pulse.
next ' Get next item from table.
' ====================== MAIN PROGRAM LOOP ==========================
' Now that the MAX7219 is properly initialized, we're ready to send it
' data. The loop below increments a 16-bit counter and displays it on
' the LEDs connected to the MAX. Subroutines below handle the details
' of converting binary values to binary-coded decimal (BCD) digits and
' sending them to the MAX.
Loop:
gosub MaxDisplay
dispVal = dispVal+1
goto loop
' ========================= SUBROUTINES ============================
' The MAX7219 won't accept a number like "2742" and display it on
' the LEDs. Instead, it expects the program to send it individual
' digits preceded by their position on the display. For example,
' "2742" on a five-digit display would be expressed as:
' "digit 5: blank; digit 4: 2; digit 3: 7; digit 2: 4; digit 1: 2"
' The routine MaxDisplay below does just that, separating a value
' into individual digits and sending them to the MAX7219. If the
' lefthand digits are zero (as in a number like "102") the
' routine sends blanks, not zeros until it encounters the first
' non-zero digit. This is called "leading-zero blanking."
MaxDisplay:
nonZ = 0 ' Clear flag for 1st non-zero digit.
for index = 5 to 1 ' Work from digit 5 down to digit 1.
shiftout DATA_n,CLK,msbfirst,[noparse][[/noparse]index] ' Send digit position.
temp = dispVal dig (index-1) ' Get decimal digit (0-4) of dispVal.
if temp = 0 then skip1 ' If digit = 0, don't set nonZ flag.
nonZ = 1
skip1:
if nonZ = 1 OR temp <> 0 OR index = 1 then skip2 ' If leading 0..
temp = 15 '..write a blank to the display.
skip2:
shiftout DATA_n,CLK,msbfirst,[noparse][[/noparse]temp] ' Send the digit.
pulsout Load,5 ' And load the display.
next ' Repeat for all 5 digits.
return ' Done? Return.