+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2018

    Default HT16K33 LED Controller

    Guy next door left and gave me some LED controllers using the HT16K33 controller. Brand new in the package from Adafruit.com, Cannot even get these things to turn on. I have no use for them but now it's become man versus nature and the entire free world hangs in the balance and I refuse to give up but am using this as a learning experience and a humbling experience both. Soldered the kits together and am fairly certain the joints are good, these are pretty basic kits and not much to them. Chip is alive as I have a heartbeat that works but absolutely nothing on the lights themselves. The address is 0X70 but found a blurb about a shift left and the address should be different but I'm not certain of anything now. I cannot upload the data sheet but it is at adafruit.com LED Quad Alphanumeric Display - Blue 0.54" Digits w/ I2C Backpack

    #IF __PROCESSOR__ = "16F887"
    cfg1 = _EXTRC_OSC_NOCLKOUT ; INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN
    cfg1&= _WDT_OFF ; WDT enabled
    cfg1&= _PWRTE_OFF ; PWRT disabled
    cfg1&= _MCLRE_ON ; RE3/MCLR pin function is MCLR
    cfg1&= _CP_OFF ; Program memory code protection is disabled
    cfg1&= _CPD_OFF ; Data memory code protection is disabled
    cfg1&= _BOR_OFF ; BOR enabled
    cfg1&= _IESO_OFF ; Internal/External Switchover mode is enabled
    cfg1&= _FCMEN_OFF ; Fail-Safe Clock Monitor is enabled
    cfg1&= _LVP_OFF ; RB3 pin has digital I/O, HV on MCLR must be used for programming
    cfg1&= _DEBUG_OFF ; In-Circuit Debugger disabled, RB6/ICSPCLK and RB7/ICSPDAT are general purpose I/O pins
    __CONFIG _CONFIG1, cfg1
    cfg2 = _BOR40V ; Brown-out Reset set to 4.0V
    cfg2&= _WRT_OFF ; Write protection off
    __CONFIG _CONFIG2, cfg2
    INCLUDE "modedefs.bas"
    define osc 4
    TRISA = %00000000 '0 means output
    TRISB = %00000000 '1 means input
    TRISC = %00000000
    TRISD = %00000000
    TRISE = %00000000
    Ansel = %00000000
    AnselH = %00000000
    OPTION_REG = $55 ' Set TMR0 configuration and enable PORTB pullups
    'INTCON = $a0 ' Enable TMR0 interrupts
    On Interrupt Goto tickint
    DISABLE debug
    Led var PortD.0
    Ticks var word
    A var word
    B var word
    C var word
    DataToSend var word
    pause 2000
    DataToSend = %0010000100000000
    i2cwrite PortD.2,PortD.3,$E0,$20,[%0010000100000000] 'system osc on
    pause 20
    'i2cwrite PortD.2,PortD.3,$E0,$80,[%1000000100000000] 'blinking off
    pause 20
    i2cwrite PortD.2,PortD.3,$E0,$EF,[%1110111100000000] 'dimming off
    pause 20
    i2cwrite PortD.2,PortD.3,$E0,$A0,[%1010000000000000] 'row set
    pause 20

    i2cwrite PortD.2,PortD.3,$E0,$0,[%1]
    pause 20
    i2cwrite PortD.2,PortD.3,$E0,$2,[%0000111111111111]
    pause 20
    i2cwrite PortD.2,PortD.3,$E0,$4,[%0000111111111111]
    pause 20
    i2cwrite PortD.2,PortD.3,$E0,$6,[%0000111111111111]
    pause 20

    high led
    pause 500
    low led
    pause 500
    goto mainloop
    ticks = ticks + 1 ' Count pieces of seconds
    If ticks < 61 Then tiexit ' 61 ticks per second (16.384ms per tick)
    high led
    pause 2000
    low led
    ticks = 0

    INTCON.2 = 0 ' Reset timer interrupt flag


  2. #2
    Join Date
    Sep 2010
    Las Vegas, NV

    Default Re: HT16K33 LED Controller

    I'm not very good at this but since no one else chimed in here's my thoughts. I was looking at the data sheet and I don't see this as a settable mode. Page 61. Most people don't bother with an external oscillator.

    cfg1 = _EXTRC_OSC_NOCLKOUT ; INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN

    define osc 4 should be define OSC 4 or DEFINE OSC 4 or DeFiNE OSC 4. "Define" can be any combination but OSC needs to be capitalized.

    The oscillator setting may be incorrect but the OSC has been key to many of my designs.

    Hope it helps

Similar Threads

  1. Replies: 1
    Last Post: - 13th August 2013, 14:53
  2. Replies: 2
    Last Post: - 15th December 2012, 02:19
  3. Replies: 2
    Last Post: - 14th July 2008, 22:11
  4. LED Light Controller
    By lightwaveengine in forum mel PIC BASIC
    Replies: 0
    Last Post: - 18th June 2006, 15:46

Members who have read this thread : 19

You do not have permission to view the list of names.

Posting Permissions

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