Show Posts
Pages: [1]
1  Using Arduino / LEDs and Multiplexing / Re: How to get Font from EEPROM on: April 30, 2013, 06:58:43 pm
data = (byte) pgm_read_byte (&myfont[disp[line][c]][y])

data = (get 8 pixels ) from (a font-character[pointed to by disp[currentline][current_character][current_character_pixel_line].

Which is a complicated way of Saying

if disp[line] = "A simple test"
then disp[line][0] = "A"
       disp[line][1] = " "
       disp[line][2] = "s"
       ... etc

then &myfont[] returns the address of a character inside a font array which holds the (8 x 8 pixels) character.
So &myfont[disp[line][0]] would return the address to the letter "A" in the font array.

&myfont[disp[line][0]][y] would return 8 pixels of row [y] of the letter "A"
This technique is used to convert a letter to pixels. e.g. (8x8 pixel font)


.  .  .  .  .  .  .  .
.  .  .  X  .  .  .  .
.  .  X  .  X  .  .  .
.  X  .  .  .  X  .  .       =>  A
.  X  X  X  X  X  .  .
X  .  .  .  .  .  X  .
X  .  .  .  .  .  X  .
.  .  .  .  .  .  .  .


It's reading 8 pixels as a byte.
Your code then loops through this code with for (byte x=0; x<8; ++x)
And draws a pixel on the screen if it found a pixel in the font.

Thats about it.
Pages: [1]