Pages: [1]   Go Down
Author Topic: Code scheme for arrayed line programming, but collecting for one big scan?  (Read 574 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok so let me clarify a little bit. I have an idea and was wondering how exactly the code should work. I know I could do this on my own but not very efficiently, and I still have to solder up my matrix to use it so I want to make sure I have at least some of these coding concepts down because depending on how it ends up in code could change some of the physical schema of what I am trying to do for my project.

*BTW, for this I am using an Atmega32L, and am going to be direct-driving an 8x8(x2color) led matrix.*

So basically I want to do this:
I want to have somecode read from say an sdcard (don't worry about getting that working, I am not going into that yet), place it into a universal 8 character array, and then basically collect it 8 times (for each row of the lex matrix) and write it into a big 8x8 item array *for each of the 8x8 led matrix leds* and THEN output the appropriate pins to light the entire amount of leds needed on the matrix at one time.

The reasoning behind the character array is for ease of app writing for the matrix later on when I make my own mini apps that can be loaded from sd card, or writing straight from serial monitor.

So really what I wanted to do is use a decimal coding scheme (in light of binary) and convert it to binary for writing the correct pins. I.E.
writeLine(0);// would end up having none of the leds in that row on.
writeLine(1);// 00000001 -on row 1
writeLine(8 );// 00001000 -on row 2
writeLine(128);// 10000000
writeLine(63);// 01000001
writeLine(255);// 11111111

And then use words to select a scroll, wipe, or other visual scheme.

But now that I have shown you that, a full screen write line from the front end code to be processed would look like this:
//would be a smiley face
writeLine(60,66,165,129,165,66,60);
/*
00____00
0_0000_0
_0_00_0_
_000000_
_0_00_0_
_00__00_
0_0000_0
00____00
*/

Also I would have a character loop array that would basically take the binary character lines, and shift them for movement.
basically if it were shifting left, then it would use a position finding loop and move the 1 one to the left in succession for 8 numbers. this would eliminate the need to write tons of code for movement on the screen. Also I was thinking of sort of an off screen buffer of 8x8 above, below, left, and right that can be used to preload a physical image in memory to be scrolled onto the screen.this would eliminate the need for writing each line manually for whatever you want to scroll onto the screen (i.e. a game's background).

With this being said I am not quite a noob at coding. I know I will end up with 1-8 integer array variable for the numbers from the front end coding scheme, a conversion loop for each item in the array to recode it into an 8 (item) 8 bit binary array to be written to the pins to control the screen, and a conversion loop to convert the 8 binary array into an 8 item 8 char array for movement on the screen. The only issue I have is how to actually convert between these to get the needed results.

Once I am done with this I am going to publish the code under creative commons as a universal direct drive 8x8 led matrix library and interfacing demo code. Using this scheme, you could even VERY easily add in code for converting keyboard characters into a character onscreen without the need for tons of code. I know this has all been done before, but I don't believe all in one and I haven't been able to find much in the form of an 8x8 library. Any help is appreciated. And btw, anyone that contributes to this will have mention in the code release.
« Last Edit: March 03, 2011, 01:05:39 am by hexskrew » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Not quite clear what the question, but here my thoughts after reading the story.

You could use 74HCN595 to drive 8 LEDs - through one pin. These can be put in serie so you can drive all 64 leds with only one pin. see - http://arduino.cc/forum/index.php/topic,54000.0.html - .

For the code I would use an array of 8 bytes that are shifted out one after another. - http://arduino.cc/en/Reference/ShiftOut

hopes this helpes
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Jr. Member
**
Karma: 1
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That shiftout function will definitely help, and my apologies for being a little squirley with my explanation, but here is some clarity on it:

The reason why I am using the 8x8 matrix in direct drive to the chip is because of cost reduction (negative switched with transistors). I have countered the amount of pins needed to use the matrix by using the Atmega32L (40pins, 32 I/O, 8 analog capable). Basically I am trying to achieve a much cheaper alternative to the Meggy Jr. *not to be manufactured, but built as a beginner's avr project, and to be used for more than just games. It would be a diy development platform, and to be scalable with a maximum cost of $50*

Here is a flow chart of what I want to do.


I want to use a numerical form of an array to be used as a sort of compression scheme for creating images to be used on the screen.
I want to convert the numerical array into a binary array for ease of editing in code of movement and effects.
I want to then convert the binary array to a form that can be used to write the pins to light the led matrix.

I know it's not efficient and basically an abomination in the world of programming, however it makes it easier for me to visualize, and there is enough horsepower in the Atmega32L to power this sort of coding scheme. Basically it's a tradeoff of wasting memory space to save coding time and smaller app space later.

What my actual question is (sorry I couldn't see the forest from the trees earlier so I forgot to actually include my question) is how to convert these arrays between the numerical and binary.
« Last Edit: March 03, 2011, 12:15:18 pm by hexskrew » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 602
Posts: 33371
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I want to convert the numerical array into a binary array
I think the point you are missing is that a numeric array IS a binary array. Binary is all there is in computing so you don't have to convert it just treat it differently.
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Gotcha! Actually I found that out not long after I made that last post. Lol. But I think I was kinda wrong with the way I was thinking... I mean don't get me wrong, this is great, but see, if I want to do a shift with binary, would I not have to first convert it to String format, and then use string manipulation to pull each char in order into an array to be used to find if a light is supposed to be on or not. If there is a way to do this numerically (pull the binary version of the number from the integer, and specifically read each binary number to light each light) I would definitely like to know.
« Last Edit: March 05, 2011, 10:12:37 pm by hexskrew » Logged

Pages: [1]   Go Up
Jump to: