|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #1 on: November 12, 2007, 03:35:02 15:35 » |
|
An idea would be to use the "union" command in ANSI-C. Then You can control a 3-dimensional array. You can possibly use a random function or some other function on how to lit the differen t LED:s.You also have to check the different pic-compiler manuals wether they support unions or not.
Good luck!
|
|
« Last Edit: November 12, 2007, 03:41:17 15:41 by robban »
|
Logged
|
Code Warrior
|
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #3 on: November 16, 2007, 02:53:25 14:53 » |
|
After givin' it some thoughts... Have a look at "Tips 'n Tricks" on Microchip site. There You can find an I/O-multiplexing method. The number of LED:s(D) that can be controlled by number of pins(P) is D = P x (P-1). In Yr. case it will take 9 pins(actually You can have room for 80 LED:s). Your task is to alternate between in-/outputs and high/low on the pins to get the desired effect.
|
|
|
Logged
|
Code Warrior
|
|
|
th_sak
Active Member
Offline
Posts: 141
Thank You
-Given: 150
-Receive: 149
|
|
« Reply #4 on: November 16, 2007, 06:11:47 18:11 » |
|
I have already thought about this method, but is not so good for this application because needs many wires from GPIO connected to LEDs and it will be a really mess with all these wires. See the images to understand. But thank you anyway robban Preferred method Microchip's method
|
|
|
Logged
|
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #5 on: November 17, 2007, 10:05:19 10:05 » |
|
I have already thought about this method, but is not so good for this application because needs many wires from GPIO connected to LEDs and it will be a really mess with all these wires. See the images to understand. But thank you anyway robban Preferred method Microchip's method Yers, that could work if You connect the different anodes to the analog ports. You have to have resistors between the different anodes and measure the voltage when the ports are configured as inputs, but how do You do it when they are outputs?
|
|
|
Logged
|
Code Warrior
|
|
|
th_sak
Active Member
Offline
Posts: 141
Thank You
-Given: 150
-Receive: 149
|
|
« Reply #6 on: November 17, 2007, 12:14:16 12:14 » |
|
Hi robban First of all thank you for your interest and your help. I think this method is too complicated and requires many lines of programming and I don't understand why I should measure the voltage when the ports are configured as inputs. After a web search I found this algorithm and seem pretty compact and working. I think I will use it as a base of my program and also use the above schematic (preferred). '--------------------------------------------------------------------------- 'Test setup note: ' PortD is low-end for the LED driver ' PortA is high-end for the LED driver ' PortC is driver for 2D Matrix select '---------------------------------------------------------------------------
'*** Config Ports *** config PortA = output config PortC = output config PortD = output
'*** Variables / storage space ***
'Create RAM storage space for each of the LEDs ' in the 8x8x8 LED matrix
Dim LEDbuffer(64) as byte
'This way the first 8 byte in the array corresponds to the ' first 2D LED array. ' The next eight bytes correspond to the next 2D LED array etc.
'Variables needed to loop through the LED buffer Array Dim Aloop as byte Dim Bloop as byte Dim LEDpointer as byte
'***** MAIN LOOP ***** DO
'Update the LED display for Aloop = 0 to 7
'open one of the 2D matrix's PortC.Aloop = 1
'now circle through each of the 8 lines of LED's in this 2D matrix for Bloop = 1 to 8
'prepare the LEDpointer LEDpointer = Aloop * 8 LEDpointer = LEDpointer + Bloop
'turn the LED lines off PortA = 0
'prepare the LED line buffer PortD = LEDbuffer(LEDpointer)
'turn that LED line on, ' that corresponds to the content of the LED line buffer PortA.Bloop = 1
next Bloop
'close the open 2D Matrix PortC.Aloop = 0
next Aloop
LOOP
End 'end program
|
|
|
Logged
|
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #7 on: November 17, 2007, 12:57:40 12:57 » |
|
Well, since You obviously do Yr. homework, You can't fail. Let me know when Yr. finished, maybe I'll learn something...
|
|
|
Logged
|
Code Warrior
|
|
|
th_sak
Active Member
Offline
Posts: 141
Thank You
-Given: 150
-Receive: 149
|
|
« Reply #8 on: November 17, 2007, 04:17:15 16:17 » |
|
Well, since You obviously do Yr. homework, You can't fail. Let me know when Yr. finished, maybe I'll learn something...
It's not homework for school or something, but I want to do it just for fun and spent my free time (when I have). Possibly I 'll start after christmas. Thank you
|
|
|
Logged
|
|
|
|
maiasj
Junior Member
Offline
Posts: 48
Thank You
-Given: 226
-Receive: 13
|
|
« Reply #9 on: November 18, 2007, 07:52:52 19:52 » |
|
I made one 5 x 5 x 5 led cube. I used 4 74hc164 to shift data for each plane (5 x 5 leds) and 5 PNP transistors to switch the planes every 20 mS. After showing the 5 planes it started again shifting the data for a new frame into plane 0.
|
|
|
Logged
|
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #10 on: November 19, 2007, 12:03:35 12:03 » |
|
I think I've seen this before... Isn't this the same technique that most graphic card programmers addres their pixels? I recall Rob Anderton(the writer of NASM - the Netwide Assembler) used this to show how a flickering fire(originally written in TASM by Dentor of Asphyxia) could be written. It's a 16-bit DOS program that can be shown in any Windows environment(maybe not Vista?). Just relax and let the flames warm You...
|
|
« Last Edit: November 19, 2007, 02:25:48 14:25 by robban »
|
Logged
|
Code Warrior
|
|
|
th_sak
Active Member
Offline
Posts: 141
Thank You
-Given: 150
-Receive: 149
|
|
« Reply #11 on: February 03, 2008, 12:58:01 12:58 » |
|
Finally the cube is ready. After a while I made a 5x5x5 led cube with high brightness blue LEDs. You can find the schematic, PCBs ant a test program in the attached file. See it in action: http://www.youtube.com/watch?v=7DDpv8N1vHs
|
|
« Last Edit: February 03, 2008, 01:02:14 13:02 by th_sak »
|
Logged
|
|
|
|
Biggles
Junior Member
Offline
Posts: 47
Thank You
-Given: 15
-Receive: 23
|
|
« Reply #12 on: March 09, 2009, 11:12:40 11:12 » |
|
Very nice. I just finished a project needing port expanders. I think maybe if you want to be able to address each LED individually you could use port expanders. Shift registers would also work.
Microchip port expanders MCP23S17 gives you 16 bit full I/O with only 4 lines needed from the CPU for SPI bus. The port exanders have hardware addressing, so you can have 8 devices on the SPI bus, give you a total of 128 outputs for the same 4 lines from the CPU.
|
|
|
Logged
|
Man who act in haste, repent at leisure.
|
|
|
eoasap
Newbie
Offline
Posts: 13
Thank You
-Given: 39
-Receive: 43
|
|
« Reply #13 on: March 09, 2009, 03:44:46 15:44 » |
|
Some students of undergrad senior design project made an LED rubics cube about a year or so back. Each LED in each side array is a single RGB led which is adjusted with PWM to produce one of 6 different colors. When you slide your finger across the LED cube, the logic inside the device changes the color, similar to moving a real rubics cube. I can probably get you in touch with them if you're interested. I agree with Robban's method for driving the solid 3D matrix. Its simple digital logic
|
|
« Last Edit: March 09, 2009, 03:59:03 15:59 by eoasap »
|
Logged
|
|
|
|
OlDrunk
Guest
|
|
« Reply #14 on: March 31, 2009, 10:57:47 22:57 » |
|
I've just built a 4x4x4 single color LED cube, based on the instructables guide , just the cube is done I still have to work on the controller. Got a lot of pics and tips of the build I'll have post some where , it was fairly easy to build.
|
|
|
Logged
|
|
|
|
|