5x3 font, ssd1306 OLED

castlerocks

New Member
Dear all,

You know you have not been here for a while, when you log on and see a new forum platform :).

I have an issue with ssd1306 based 64x32 OLED. I can use 8x5 font with no problems as the chip supports receiving 8 vertical pixels as one byte. Thus, you send 5 such bytes and voila - you have a character. Now, I want to print smaller characters. Like 5 or maybe 7 pixels high. I can figure out the font (or find it on the internet), but what I do not understand is, how do I print row 2 not at pixel 9 from the top, but, say, pixel 6. Looking at pages 37 and 38 here probably help to understand my question if you have not dealt with these displays before.

Thank you for your time,

Edmunds
 

hippy

Ex-Staff (retired)
There are two options available; the simplest, easiest and with fastest performance, is to keep a copy of the complete display memory within the PICAXE, update that then copy the memory out to the display memory. 64x32 is 2048 pixels or bits, 256 bytes, which could be held in variable RAM or Scratchpad memory.

The other option is to read existing bytes from the display memory, update the pixels you need to change then write them back again.
 

AllyCat

Senior Member
Hi,

7 x 5 pixel characters in an 8 x 6 cell are about as small as you can get for a full ASCII character set. Numbers may fit into a 3 x 5 font, i.e. 4 x 6 cell (but 4 x 8 would be better), similar to a 7-segment display, and perhaps "identifiable" capital letters, but consider how B/8 , 0/O/D/Q and H/K/M/W , etc. will look.

Basically you need to build each 8-pixels (high) row in local (PICaxe) memory, from two "input" rows and then transfer the row into the display memory. For example, for 6 pixels high rows, you would "OR" (or perhaps EXOR) the pixels from two consecutive rows, i.e. "Display Row 1" would take the 6 (vertical) pixels from Input Row 1 and OR it with the top two pixels (<<6 ) of input Row 2. Then Display Row 2 will take the remaining 4 pixels (i.e. >>2) of Input Row 2 ORed with the top 4 pixels (<<4) of Input Row 3, etc.

Cheers, Alan.
 

hippy

Ex-Staff (retired)
There is some gain for using smaller font sizes, on a 64x32 display -

5x7 gives 4 lines of 10 characters
5x5 gives 5 lines of 10 characters
4x5 gives 5 lines of 12 characters
3x5 gives 5 lines of 16 characters

One trick is to switch between fonts so it could be 5 wide for letters and 3 wide for digits. One can even go for a fully proportionally-spaced font.

One could have a top line 7 high and another four lines 5 high.
 

castlerocks

New Member
There are two options available; the simplest, easiest and with fastest performance, is to keep a copy of the complete display memory within the PICAXE
Thanks hippy, seems to be the way to go. There are 256 bytes of scratchpad in 20x2 (my version of manual2 says 128!!!), which can run with 64MHz without external resonator. This should work for updating the entire display well enough. The application is a scoreboard in a train station on a model railroad, connected to train routes and schedules. I've seen many that update slowly in real life, so maybe the lagging update could even be a special effect :).

Cheers,

Edmunds
 

hippy

Ex-Staff (retired)
There are 256 bytes of scratchpad in 20x2 (my version of manual2 says 128!!!)
The manual is correct to the best of my knowledge. It's easy enough to check -
Code:
#Picaxe 20X2
#Terminal 9600
#No_Data

ptr = 0       ; Start at 0
ptr = ptr - 1 ; Wrapround to last
w0  = ptr + 1 ; How many is one more than last
Do            ; For example, 0-127 = 128
  Pause 2000
  SerTxd("Scratchpad size = ", #w0, CR, LF )
Loop
 
Top