Sketch examples of scrolling text on 8x8 LED matrix w/ MAX72xx

bratan:
Also why bufferLong is 7? Should it be 14 if using 2 displays? Or it doesn't matter?

I am using a 5x7 font (5 bits wide x 7 bits deep) but it is stored as 8 bits wide (byte) as this is what processors like and it makes the maths easy XD. The font is only 7 bits tall so I only need 7 buffers but these buffers are longs so are 32 bits wide. What happens when you scroll a character is it's matrix data (8 bits wide) is loaded from font5x7 and places in the lower 8 bits of the 7 bufferLong's (keeping the upper 24 bits) it then reads the 8th byte from the font5x7 matrix data that is the number of bits to scroll this particular character (kerning). It rotates the bufferLong's by 1 bit and then displays the bits 16-23 in the first (left) LED matrix and bits 8-15 in the right LED matrix. It keeps rotating one bit at a time and displaying until the character width has rotated out of the lower 8 bits of the buffer and then goes back to get the next character so scroll.

What does this this code exactly performs?

pgm_read_byte_near(font5x7 + ((ascii - 0x20) * 8) + a);

I understand you are reading it from prog memory and offsetting by 20 characters to get right ASCII, but not sure what "*8" is for and what "font5x7 +" does? Your adding something to an array name not array's element?

The font data is stored as a single dimension byte array (a contiguous block of memory), I need 7 bytes to describe the font data for a single character and the 8th byte is the width of that character in bits (used for kerning). font5x7 point to the starts of this memory so for each increment in the Ascii number I have to jump 8 bytes of this contiguous memory to find the start of that characters font data.

Edit: Ok I hooked up my LED matrices, and your code totally works... except it looks like I have mine wired/arranged differently from yours :frowning: Instead of scrolling from one matrix to another, it scrolls as if they arranged one on top of each other (i.e. image is rotated 90 degrees clockwise, so it's not going from right to left, but from bottom to the top on each). I need to figure how to to rotate image 90 degrees CW (i.e. rows become columns, etc.).

To do this you would need to re-define the font data and alter the way scrolling works, I'm sure someone else has done scrolling this way so if you find the fonts and code it could be adapted to the MAX7219.