💾 Archived View for librehacker.com › gemlog › tech › 20220507-0.gmi captured on 2024-08-18 at 18:44:27. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-05-10)

-=-=-=-=-=-=-

LCD "Bitmap"

The LCD display doesn't have a bitmap graphics mode, but one can get something similar using CGRAM characters, which are characters in memory that can be modified by the user during runtime. So, you can set those characters to have certain pixels lit up, and then draw those characters anywhere you want on the display. The constraints are that you only get 8 such characters to work with, and if a character is used more than once on the screen at the same time, then it must look the same in both places.

One approach, using just CGRAM characters, is to divide each character into three rectangle-shaped pixels, which gives me a resolution of 20x12 on my 20x4 character display.

LCD "bitmap" grid

You can not divide it up more than that because you would not have enough CGRAM characters to represent all the possible pixel on-off combinations. Dividing it into four blocks per character would require 2^4 or 16 CGRAM characters, and so on.

Having written the appropriate pattern data into CGRAM, then you just write the appropriate character codes into each line. Here is an image of a sine wave:

img/lcd-sine.jpg

It is a little tricky to code a proper bitmap drawing interface to this, since each character represents three different pixels, and since the LCD character lines are not in the order you would expect in memory. But I may do this in the future.

Comments

Alaskalinuxuser, 2022-05-08

Very interesting!