smittytone / HT16K33-Python

Combination Micropython and Circuitpython drivers for various HT16K33-based LEDs
https://smittytone.net/docs/ht16k33.html
MIT License
31 stars 7 forks source link

Characters being displayed as CDAB #17

Closed MoJeeza closed 3 months ago

MoJeeza commented 3 months ago

Hello Tony,

First let me thank you for sharing the drivers of HT16K33 display for use with MicroPython. So here is my issue.

I am using the 4 character, 14Segment display (with a decimal point) from a RPi-Pico-W connected to Rpi5 using Thonny. I am also using the same display with MicroBit V1 connected to a Windows Laptop using Make Code App. It is an I2C display.

Using the Block Based code from MakeCode (or JavaScript) . To use the display, I have to load an extension in MakeCode (akin to loading the drivers for HT16K33 in microPython) by TinkerCademy (screen shot attached)

image

The block code is:

image

The resulting JS code is:

image

So the display shows "1234" and "ABCD" as expected.

However, when I use the same display on Pico-W using your driver, the display shows "CDAB" or "3412" but the print_chars() function shows "ABCD" on the REPL output.

Here your example code modified to show this issue:

`# IMPORTS import utime as time from machine import I2C, Pin, RTC from ht16k33 import HT16K33Segment14

CONSTANTS

DELAY = 0.01 PAUSE = 3

def print_chars(): global a print (chr(a), chr(a+1), chr(a+2), chr(a+3))

START

if name == 'main':

Configured for the Raspberry Pi Pico -- update for your own setup

i2c = I2C(0, scl=Pin(9), sda=Pin(8))
display = HT16K33Segment14(i2c, is_ht16k33=True)
display.set_brightness(2)
display.clear()
a = 65
display.set_character(chr(a), 0, False )
display.set_character(chr(a + 1), 1, False )
display.set_character(chr(a + 2), 2, False )
display.set_character(chr(a + 3), 3, False )
print_chars()
display.draw()

`

I have no idea what's causing this and why. The MakeCode drivers/extension is not from the Manufacturer of the display. So, it is kind of a third party driver.

Thanks and kind regards,

smittytone commented 3 months ago

Will take a look

smittytone commented 3 months ago

What happens if you use display = HT16K33Segment14(i2c, is_ht16k33=False) instead?

Also, can you tell which specific display you are using?

MoJeeza commented 3 months ago

Pics of the 4x14 segment display PXL_20240723_210902351 PXL_20240723_210924211 PXL_20240723_211344962

I just noticed: For the digit zero (0) the diagonal segments are not showing correctly (see the second picture below) Pictures with =True First file is ABCD Second file is: 0123

True_PXL_20240723_215054937 True_PXL_20240723_215100016

=False First file is ABCD Second file is: 0123

False_PXL_20240723_215123266 False_PXL_20240723_215128776

smittytone commented 3 months ago

OK, so it's definitely a Holtek chip on there. Looks like it might be an issue with how the LEDs are connected to the HT16K33 on the board, as I didn't see this with me test boards (the two referenced in the Read Me). But let me double-check the code.

smittytone commented 3 months ago

OK, I've re-run the examples/micropython/test_segment14_ht16k33.py code and I cannot reproduce this issue. I also tried your code, and that worked as expected too. IMG_2017 As I say, I wonder if there's an issue with the circuit layout on the display board. I tried to look it up on Elecfreaks, but I could not track it down. Maybe this issue is why it's no longer for sale?

MoJeeza commented 3 months ago

Thank you Tony. Greatly appreciate you following up.

smittytone commented 2 months ago

At least it's a clearly defined effect, so you can code around it if you want to.