I am trying to develop a Braille printer and while gathering for information I came across this piece of code.
As far as my knowledge goes, this is a byte double dimension array but the way the values are expressed in the array, are making me confused. If anyone can infer some sense from this code, please do let me know.
All the help is appreciated. Thanks in advance and this is the link from where I got the above code. http://playground.arduino.cc/Code/PCD8544
Normally, if a display says X by Y dots, it means the x values have the range [0,X-1] and y values [0, Y-1].
But this module is a bit different.
Though it's a 84x48 dot display, y can range only [0-5] . Effectively dividing the vertical 48 pixels into 6 rows of 8 dots each.
So row #0 covers vertical pixels [0-7], row #1 covers vertical pixels [8-15], ..... row #5 covers vertical pixels [40-47]
If you want to draw pixel at y=12, in most displays you'd say plot(x,12) but in this display y=12 has to be converted into a row number. Row #1 for y=12.
Since one row covers 8 vertical pixels, the individual pixels in that row are then turned on or off by an 8-bit value. 1 bit for each pixel in the row.
For example, if you want to plot pixel only at (x=30, y=12), first convert y=12 to its row - Row #1 - and set its 8 bit value as binary "00010000" (turn on 5th bit because 5th bit represents 5th pixel in that row)
In your code, each glyph is 5 dots wide x 8 dots high. Take one example for exclamation mark:
0x5f in binary is "01011111"
If you rotate that bit pattern vertically,
Do you spot the exclamation mark in that pattern? ;)
If you rotate those binary values vertically, and representing 0s by .s for visual clarity:
Now my question to you: I'm curious how this code helps with a braille printer implementation. This module's addressing is a rather quirky one and most modern displays don't follow it.