Yes, there are 8 custom characters and char #255 - Full block is used.
Yes, there are 8 custom characters and char #255 - Full block is used.
Here's 2x2 font for 1602 OLED (Here you can write bytes directly, not limited by 8 custom chars).
![]()
Wanted to store above font in EEPROM. each character takes 2x13 bytes. so 260 byte of memory are needed, but most chips have only 256 bytes of eeprom available.
I come up with run length encoding compression idea. Since there are only 5 bits used, can use remaining 3 as a counter, showing how many times current pattern should be repeated. This gives ability to repeat up to 8 positions
Say for character 4 (top left part), in "normal" mode, bit pattern looks like this: %11000. But if we add %110 to end of it, so it now looks like %11000110, decoder software will know that it have to repeat that pattern 6 times.
So code for reading and decoding char to appropriate DDRAM or whatever it is called, should work like this:
1. Set pointer address from which the bitmap should be read.
2. Read it, if 3 last bits<>0 then separate it, and do the loop, writing the code of first 5 bits, repeating them times specified in these 3 bits.
3. Continue reading of bitmap as needed.
But I have issue with statement for dividing bit variable into two. Say I have %10101010. How should I divide it into two variables, one which has 5 bits from left, and another having 3 bits from right?
Yes, but I was thinking about either <<, >> or DIG() operators...
then combine accordingly like that:
to make it right justified if needed.Code:a_left=(byte_var & %11111000)>>3
Ioannis
Found interesting thing. On power up, custom character area in normal LCD are empty, but on WS0010 OLED displays, they are filled with random numbers on power up.
Just did a rough estimation - the above idea should save 30-40% of EEPROM space. Not bad.
Also it is possible to separate and replace some similar blocks with additional indexes - this should save additional 10-20%...
Bookmarks