HX1230 96x68 Mono LCD - Nokia 5110 killer

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
User avatar
mcauser
Posts: 400
Joined: Mon Jun 15, 2015 8:03 am

HX1230 96x68 Mono LCD - Nokia 5110 killer

Post by mcauser » Mon Aug 19, 2019 5:54 am

I created a library for HX1230 96x68 monochrome LCDs.
https://github.com/mcauser/micropython-hx1230

"upgrade of the Nokia 5110 LCD"

Image

Using bit-bang SPI and hardware SPI and included a version which extends the Framebuffer.
Last edited by mcauser on Mon Aug 19, 2019 6:58 am, edited 1 time in total.

User avatar
mcauser
Posts: 400
Joined: Mon Jun 15, 2015 8:03 am

Re: HX1230 96x68 Mono LCD

Post by mcauser » Mon Aug 19, 2019 6:01 am

The display module is configured to use 3-wire SPI mode (No D/C pin).
This means, the DIN pin expects 9 bits per transfer: D/C, then 8 data bits on each CLK pulse.

I was able to bit bang this, but then I discovered I could use hardware SPI by sending two bytes (16 bits) per command, with some padding.
First byte: D/C then 7 data bits (MSB first)
Second byte: 1 data bit (LSB), 7 padding zero bits.

User avatar
jimmo
Posts: 553
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: HX1230 96x68 Mono LCD - Nokia 5110 killer

Post by jimmo » Tue Aug 20, 2019 5:06 am

Neat!

This is just so you can play Snake, written in MicroPython, on a 5110 display right? :)

(a quick Google turned up https://github.com/Zhebr/snake)

User avatar
mcauser
Posts: 400
Joined: Mon Jun 15, 2015 8:03 am

Re: HX1230 96x68 Mono LCD - Nokia 5110 killer

Post by mcauser » Tue Aug 20, 2019 5:49 am

I've been mucking around with this display and found the Nokia 5110 display to be significantly faster.

Having to send the 9-bit SPI as 16 bytes means tons of wasted bytes being sent.
96 * 72 / 8 * 7 = 6048 extra padding bits for a full screen refresh.
If I can figure out how to send multiple sequential data bytes, should dramatically improve the speed.

And yes, I'll put together a ubiquitous snake demo at some point :D

User avatar
Roberthh
Posts: 1572
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: HX1230 96x68 Mono LCD - Nokia 5110 killer

Post by Roberthh » Tue Aug 20, 2019 6:10 am

Can't you pack that further, like 8 screen symbols in 9 bytes? Obviously, it's a little bit more code, which needs time to pack, which may be slower that just using two bytes for each symbol.

User avatar
mcauser
Posts: 400
Joined: Mon Jun 15, 2015 8:03 am

Re: HX1230 96x68 Mono LCD - Nokia 5110 killer

Post by mcauser » Tue Aug 20, 2019 7:28 am

@Roberthh I tried squishing it like that, but couldn't get it working.

Edit: Tried again tonight and it worked this time!
Now I just need to figure out how to pack 1 extra bit before every 8th bit, efficiently.

User avatar
mcauser
Posts: 400
Joined: Mon Jun 15, 2015 8:03 am

Re: HX1230 96x68 Mono LCD - Nokia 5110 killer

Post by mcauser » Thu Aug 22, 2019 3:11 pm

Updated to pack 8 data bytes into 9 bytes, with a byte of DC bits.

On ESP8266, full screen writes (864 bytes) are now more than 2x faster, without writing all of those padding bits.

CPU running at 80mhz
Before: 241,105 us
After: 114,265 us

CPU running at 160mhz
Before: 168,606 us
After: 63,752 us

Post Reply