• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Need Help in understanding the glyph table

 
Ranch Hand
Posts: 106
2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Everyone

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

Regards,
Ranajoy Saha
 
Marshal
Posts: 16594
277
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are hexadecimal values (base 16). See https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html, about halfway down that page, under the section header Integer Literals
 
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:They are hexadecimal values (base 16). See https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html, about halfway down that page, under the section header Integer Literals



Comments at the end of the lines still don't make sense to me when looking at the data structure except that it looks like old 0-127 encoding since no values seem to be equal or above 0x80
 
A.J. Côté
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vendor specific codes? 0x20 space seem to be the same for everybody.

 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What exactly do you not understand about it - something with the syntax, or what these codes mean?

It's indeed an array of arrays, with 5 bytes in each array inside the large array.

It looks like the code has something to do with displaying something on an LCD screen. The codes are probably 5 x 8 bitmaps for characters on the LCD.

Let's for example look at the bytes for the character "0": { 0x3e, 0x51, 0x49, 0x45, 0x3e }

Let's write these out in binary:

0x3e = 00111110
0x51 = 01010001
0x49 = 01001001
0x45 = 01000101
0x3e = 00111110

Do you already see a pattern there? I'll make it easier to see by replacing the 0's by . and the 1's by X:

..XXXXX.
.X.X...X
.X..X..X
.X...X.X
..XXXXX.

It's indeed a bitmap!
 
A.J. Côté
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jesper de Jong wrote:

It looks like the code has something to do with displaying something on an LCD screen. !



Tactile LCD or Braille printer?

Technically, it's not really LCD although.
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to the link that Ranajoy posted this is to display something on an LCD, and not a braille device.

Note: The code is in fact in C, and not in Java.
 
A.J. Côté
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jesper de Jong wrote:According to the link that Ranajoy posted this is to display something on an LCD, and not a braille device.

Note: The code is in fact in C, and not in Java.



Interesting, thanks!
 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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? ;)

Another example:

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.
 
This tiny ad is wafer thin:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic