HT16K33 led 14 segment backpack


+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2016
    Posts
    96

    Default HT16K33 led 14 segment backpack

    Hi folks,

    I want to ask members, someone has done working with this HT16K33 14. segment LED backpack in PBP.
    https://www.adafruit.com/product/1911
    I am trying to get this thing live, but no success. Any help welcome.

    Thanks.

    Louis

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    1,930

    Default Re: HT16K33 led 14 segment backpack

    i did post an example but its been expunged or lost when the forum crashed, all i can find on my pc is this

    Code:
    ;7x5 led array witk ht16k33  mapped col 0-5  a0 - a6;highbyte of ROW[x] maps to a0:7  i2cread/write natively sends high byte first.
    ;chip actually wants data lowbyte first   ~! typical
    ;pic12f1822
    #CONFIG
        __config _CONFIG1, _FOSC_INTOSC & _MCLRE_ON & _CP_OFF & _CPD_OFF
        __config _CONFIG2, _PLLEN_OFF & _LVP_OFF
    #ENDCONFIG
    
    
    OSCCON = %01110000 
    DEFINE OSC 8 
    
    
    TRISA = %001011       
    
    
    ANSELA = 0				'Digital
    '    DEFINE DEBUG_REG PORTA
    '    DEFINE DEBUG_BIT 0      ;  if not used for pwr  
    '    DEFINE DEBUG_BAUD 9600
    '    DEFINE DEBUG_MODE 0     
    '    pause 2000
    '    Debug "Start",13 ,10 
     
    ' DISPLAY ON  0X21
    ' NO BLINK    0X81
    ' ROW/INT     0XA0
    ' BRIGHT      0XEX
      
     scl var portA.4
     sda var portA.5
     Led var LATA.2
     
     SADD VAR BYTE
     ROW VAR WORD[5]
     COL var byte
     TMP VAR WORD
     CLEAR
    
    
     INIT:
     i2cwrite sda,scl,$E0,[$21] 'on 
     i2cwrite sda,scl,$E0,[$81] 'blink off
     i2cwrite sda,scl,$E0,[$E8] 'HALF BRIGHT
     i2cwrite sda,scl,$E0,[$A0] 'NO INT
     i2cwrite sda,scl,$E0,[SADD,ROW,ROW,ROW,ROW,ROW] ;CLEAR
    
    
    Main:
        COL=35
        while col        ;walk a led backwards through array
            col=col-1
            TMP=0
            TMP.0[14-(COL/5)]=1
            SADD = 5
            WHILE SADD
                SADD=SADD-1
                ROW[SADD]=0
            WEND          
            ROW[(COL//5)]=TMP
            i2cwrite sda,scl,$E0,[SADD,ROW[0],ROW[1],ROW[2],ROW[3],ROW[4]]
            pause 100
        wend 
        SADD = 0
        FOR ROW=0 TO 127
            ROW=ROW<<8
            i2cwrite sda,scl,$E0,[SADD,ROW,~ROW,ROW,~ROW,ROW]
            pause 50
            ROW=ROW>>8
        NEXT
        FOR COL=0 TO 34
            TMP=0
    '        SADD=COL//5
            TMP.0[14-(COL/5)]=1
    '        Debug 13,10,#COL,9,HEX TMP,9,#SADD
            SADD = 5
            WHILE SADD
                SADD=SADD-1
                ROW[SADD]=0
            WEND          
            ROW[(COL//5)]=TMP
            i2cwrite sda,scl,$E0,[SADD,ROW[0],ROW[1],ROW[2],ROW[3],ROW[4]]
            pause 100
        NEXT 
        LED=!LED
        pause 500
    goto main
    end
    This is more entertaining than Free to Air TV

  3. #3
    Join Date
    Mar 2016
    Posts
    96

    Default Re: HT16K33 led 14 segment backpack

    Thanks for reply. Not working but now more clear for me how to handle this controller. I tried init the controller with default I2c adress $70 like this:
    Code:
    ;pic 12F1840
    #CONFIG
        __config _CONFIG1, _FOSC_INTOSC & _MCLRE_ON & _CP_OFF & _CPD_OFF
        __config _CONFIG2, _PLLEN_OFF & _LVP_OFF
    #ENDCONFIG
    
    
    OSCCON = %01110000 
    DEFINE OSC 8 
    
    
    TRISA = %000000      
    
    
    ANSELA = 0				'Digital
      
     scl var portA.2
     sda var portA.1
     
     SADD VAR BYTE
     ROW VAR WORD[5]
     COL var byte
     TMP VAR WORD
     CLEAR
    
     INIT:
     i2cwrite sda,scl,$70,[$21] 'on 
     i2cwrite sda,scl,$70,[$81] 'blink off
     i2cwrite sda,scl,$70,[$E8] 'HALF BRIGHT
     i2cwrite sda,scl,$70,[$A0] 'NO INT
     i2cwrite sda,scl,$70,[SADD,ROW,ROW,ROW,ROW,ROW] ;CLEAR
    
    pause 200
    
    ;send something
    
    row=5
    SADD=1
    
    i2cwrite sda,scl,$70,[SADD,ROW[0],ROW[1],ROW[2],ROW[3],ROW[4]]
    No sign of life.

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    1,930

    Default Re: HT16K33 led 14 segment backpack

    No sign of life.
    would not expect any with $70 as an address , if you have a ht16k33 the address is %1110xyz0 where xyz are a2 a1 a0

    if a0-a2 are set low the the address is $e0 as per my example
    This is more entertaining than Free to Air TV

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    1,930

    Default Re: HT16K33 led 14 segment backpack

    not only that row[0] to [4] are set to 0 still

    Code:
    ;pic 12F1840#CONFIG 
       __config _CONFIG1, _FOSC_INTOSC & _MCLRE_ON & _CP_OFF & _CPD_OFF  
      __config _CONFIG2, _PLLEN_OFF & _LVP_OFF
    #ENDCONFIG
    OSCCON = %01110000 
    DEFINE OSC 8 TRISA = %000000      
    ANSELA = 0				'Digital  
    scl var portA.2 
    sda var portA.1
      SADD VAR BYTE 
    ROW VAR WORD[4] 
    COL var byte 
    TMP VAR WORD 
    CLEAR 
    INIT:
     i2cwrite sda,scl,$e0,[$21] 'on  
    i2cwrite sda,scl,$e0,[$81] 'blink off 
    i2cwrite sda,scl,$e0,[$E8] 'HALF BRIGHT 
    i2cwrite sda,scl,$e0,[$A0] 'NO INT
     i2cwrite sda,scl,$e0,[SADD,ROW,ROW,ROW,ROW] ;CLEAR
    pause 200;send something
    row[0]=5:row[1]=4:row[3]=2:row[0]=1
    SADD=1 ; not sure about this might need to be 0
    i2cwrite sda,scl,$70,[SADD,ROW[0],ROW[1],ROW[2],ROW[3]]
    Last edited by richard; - 11th April 2021 at 15:15.
    This is more entertaining than Free to Air TV

  6. #6
    Join Date
    Mar 2016
    Posts
    96

    Default Re: HT16K33 led 14 segment backpack

    That default address I got from product listing:

    IIC address: default address 0X70
    A0, A1, A2,: IIC data address control terminal
    IIC address calculation: 0X70+A0+A1+A2 (floating is 0, shortet A0 is 1, A1 is 2, A2 is 4,
    for example A0 and A2 is shorted the IIC address at this time = 0X70+1+4=0X75)

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    1,930

    Default Re: HT16K33 led 14 segment backpack

    that's for a 7 bit i2c address scheme, arla arduino. pbp uses an 8 bit address for i2c
    This is more entertaining than Free to Air TV

  8. #8
    Join Date
    Mar 2016
    Posts
    96

    Default Re: HT16K33 led 14 segment backpack

    Of course, you're right. Now something happening. The display lit up and does some counting and flickering with segments.
    That with your firstly posted code. Now figuring out how to display numbers and characters.

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    1,930

    Default Re: HT16K33 led 14 segment backpack

    don't lose sight of the fact that my code is for a 5 x 7 bit matrix , you have a 4 x 14 bit alpha led's
    This is more entertaining than Free to Air TV

Similar Threads

  1. 7 segment led displays
    By raybel in forum FAQ - Frequently Asked Questions
    Replies: 3
    Last Post: - 12th September 2013, 17:22
  2. Seven Segment LED
    By Brian in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 5th May 2011, 04:26
  3. Replies: 3
    Last Post: - 5th December 2008, 15:00
  4. Dual 7-segment LED display counter
    By mosbc69 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th November 2008, 22:53
  5. Dual 7-Segment LED Display
    By erice1984 in forum Schematics
    Replies: 14
    Last Post: - 2nd July 2007, 23:51

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts