HX1230 96x68 Mono LCD - Nokia 5110 killer
HX1230 96x68 Mono LCD - Nokia 5110 killer
I created a library for HX1230 96x68 monochrome LCDs.
https://github.com/mcauser/micropython-hx1230
"upgrade of the Nokia 5110 LCD"
Using bit-bang SPI and hardware SPI and included a version which extends the Framebuffer.
https://github.com/mcauser/micropython-hx1230
"upgrade of the Nokia 5110 LCD"
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.
Re: HX1230 96x68 Mono LCD
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.
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.
Re: HX1230 96x68 Mono LCD - Nokia 5110 killer
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)
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)
Re: HX1230 96x68 Mono LCD - Nokia 5110 killer
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
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
Re: HX1230 96x68 Mono LCD - Nokia 5110 killer
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.
Re: HX1230 96x68 Mono LCD - Nokia 5110 killer
@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.
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.
Re: HX1230 96x68 Mono LCD - Nokia 5110 killer
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
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
Re: HX1230 96x68 Mono LCD - Nokia 5110 killer
That's great work, I'm going to try out your driver as soon as my HX1230 gets here. You started out using 9-bit transfers with two bytes. But looking at the hardware SPI specs for the ESP32 here, http://docs.micropython.org/en/latest/l ... e.SPI.html, it says that number of bits is variable in the init statement.
The docs go on to say,
Code: Select all
SPI.init(baudrate=1000000, *, polarity=0, phase=0,
bits=8,
firstbit=SPI.MSB, sck=None, mosi=None, miso=None, pins=(SCK, MOSI, MISO))
I tried to find specifics about the ESP32's SPI hardware interface, but couldn't find anything about bit width. Is this a possiblility and has anyone tried it?bits is the width in bits of each transfer. Only 8 is guaranteed to be supported by all hardware.
-
- Posts: 19
- Joined: Wed Jul 26, 2017 5:15 pm
Re: HX1230 96x68 Mono LCD - Nokia 5110 killer
I have esp32 and nokia 1202 lcd. It uses ste2007 like hx1230.
I couldn't run it. I think I am wrong about esp32 spi configuration. were you able to run it?
I couldn't run it. I think I am wrong about esp32 spi configuration. were you able to run it?