Topic: Code scheme for arrayed line programming, but collecting for one big scan? (Read 784 times)previous topic - next topic

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 1writeLine(8 );// 00001000 -on row 2writeLine(128);// 10000000writeLine(63);// 01000001writeLine(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 facewriteLine(60,66,165,129,165,66,60);/*00____000_0000_0_0_00_0__000000__0_00_0__00__00_0_0000_000____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.

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.

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.