Using the HT16K33 in DVD Player Panel Applications D/N:AN0363E Introduction The HT16K33 is a memory mapping and multi-function LED controller driver. The maximum display capacity in the device is 128 dots (16 segments 8 commons) with a 13 3 (Max.) matrix key scan circuit. The software configuration features of the HT16K33 make it suitable in a wide range of LED applications including LED modules and display subsystems, such as industrial control indicators, digital clocks, thermometers, counters, multimeters, VCR sets and others. The device can easily communicate with other microcontrollers using its I²C interface. Demo Basic Features Operating Voltage: 4.5V ~ 5.5V Integrated RC oscillator I 2 C bus communication interface Can upgrade its programs in-circuit using a 5-pin interface 16 levels of LED brightness control 16 8 bit RAM for display data storage Supports a maximum 16 8 dot display: 16 segments 8 commons Integrated key-scan function with a maximum of up to 13 3 key matrix Pressing any key can wake-up the system from the standby mode Package type: 20/24/28-pin SSOP Demo Function and Usage Description Demo Functional Description LED Display Function Display the playing track or the time and the state of the current playing mode. Track selection and the LED Panel brightness setting function select the track; adjust the LED panel brightness level. Playing mode selection function In the stop mode, setup the playing mode by pressing the Mode switch. 1
Demo Usage Description ICP Track Timer Power KeyBoard Input Switch Power Mode Play Stop Pause PBC Fast Bright Up Down Function Power:Enable / Disable LED display (1) Enable the LED Panel display, the Power LED remains on. (2) Enter the standby mode, the LED Panel display is off, the Power LED is flashing. First press on the Power Switch (Initial): (1) The Track, Hour and Minute display 0, the DVD lights up. (2) The Dial, and all light up. (3) The brightness is set to the maximum value (display 016). (4) The HT16K33 supports a function where any key can wake up the system from the Standby Mode. Therefore after being woken up, it will display the function which the Key Data read out belongs to. For example, if the Play switch is pressed to wake up the system, then it will start the Play function and display the relevant state. Mode: playing mode setting Initial state: DVD display is on; Press the Mode switch: DVD display is off, VCD display is on and the VCD playing mode is entered; Press the Mode switch again: VCD display is off, MP3 display is on and enter the MP3 playing mode; Press the Mode switch again: VCD display is off, DVD display is on. Return to the VCD playing mode. The three playing modes can be obtained cyclically as above. Play: the music play switch (1) and light up, the dial rotates. (2) Play the music from the list 001 (increasing). (3) Minute and second are increasing. Stop: the music playing stop switch (1) Track, Hour and Minute all display 0. (2) The Dial, and all light up. (3) and are off. Pause: the music playing pause switch (1) Display the current state, the dial and timer stop until the Play switch is pressed. (2) Press the Bright switch then it will display the brightness level in the Track display area. The brightness can be adjusted. A short time after the adjustment, it will return to display the track just stopped. PBC:PBC function control switch (1) Press the switch, the PBC lights up; press the switch again, the PBC is off. (2) In the PBC mode, display is off. Fast: Track adjustment switch (1) Must be in Play state. (2) Then press the Up SW, increase the current track displayed in the track area by 1, the maximum can be 999. (3) Then press the Down SW, the current track displayed in the track area minus 1, the minimum can be 000. Bright: LED Panel brightness adjustment switch Under any condition, it can be adjusted from 000~016 displayed briefly in the track area. In the Fast SW mode, the track will increase by one. If the switch is held down it will automatically increment quickly. In the Bright SW mode, the LED Panel brightness will increase by one. If the switch is held down it will automatically increment quickly. In the Fast SW mode, the track will increase by one. If the switch is held down it will automatically decrement quickly. In the Bright SW mode, the LED Panel brightness will increase by one. If the switch is held down it will automatically decrement quickly. 2
Hardware Design Principles Hardware Block Diagram Hardware Diagram Description The complete system consists of a 5V Adapter, a Keyboard, an LED display panel, the master MCU HT68F30 and the driver chip HT16K33. Keyboard: select functions by pressing the corresponding key LED display panel: indicate the different function state 5V Adapter: Supplies power for the MCUs. Hardware Operating Principle HT68F30 Control Circuit Circuit Description: PA0, PA2, RESB: ICP download lines PA3/INT0: HT16K33 interrupt pin input PA4, PA5: I²C data and clock pins PB5: Power LED driver pin After power on, the HT16K33 enters the Standby Mode and the Power LED will be flashing. The LED panel display will be off. Then press the Power switch. The Power LED will remain on and the device will exit the Standby Mode. If the Power switch is pressed again, it will enter the Standby Mode and the Power LED will again flash. 3
HT16K33 KeyBoard and LED Panel Driver Circuit S/W Flowchart and Description The following program description and attachments give details about the flowchart and the corresponding circuit. Refer to the HT16K33 datasheet for the related descriptions regarding initialisation, reading the key data, rewriting display data (address setting) and others. The main Flowchart steps are the following: Initialisation HT16K33 power on reset and ensure a delay time is implemented Initialise settings for the HT16K33 internal system clock, dimming, blinking and display Start Initial Delay 100ms for HT16K33 Power on reset Internal system clock enable ROW/INT pin set INT Output Low level Diming, Blinking, Display all off Bright Level and Data that will transimit to Display RAM initial Time Base0 1. According the External Int Flag or Every 24ms Read RAM 40H~45H To check Key Trigger. 2. If Has Key Trigger, Read Key Value and Set the Relevant Flag, then deal with the Key events and set Variable the relevant Value CLR WDT Time Base1 1. According to the setted Variable Value, finish writing the display RAM 00H~0DH through one arithmetic 2. According to the Key Flag to Control the Power LED light on or Dimming 4
Main Flowchart Description Every 24ms a TimeBase 0 interrupt is generated to implement key scanning or according to the external interrupt flag, to read the key value. After reading the key value, the key events are managed and the relevant flags set. After the next 24ms arrival, check whether the key is released. If not, determine if it is a long key press; if yes, then take it as a normal key press. In the TimeBase1, the program will rewrite the Display RAM after using a shifting algorithm to the variable values which are set in the TimeBase0 and determine whether it is the brightness that is to be adjusted and to then display the LED Panel brightness value. Another purpose for TimeBase1 is to control the Power LED light on or off according to the key flag. As can be seen in the Display RAM description above, the COM0~COM7 automatically output their waveform. Changes to any one of them will lead to a rewrite in the 8-byte space which also means every change to the display requires a rewrite to all the RAM data. In the application program, there are ten ROW control bits, DG0_temp~DG9_temp, which are obtained from a look-up table. After sequentially shifting the bits with the same odd and even data together, write the new data shifted out to the RAM. Finally shift out the 8 bits of data of each byte and write them to the corresponding Display RAM to complete a data update. Shift data Flowchart: Eight Even RAM Rows RRC DG0_temp Two Odd RAM Rows RRC DG8_temp RRC DG1_temp RRC DG9_temp RRC DG2_temp CLR C RRC DG3_temp RRC DG4_temp RRC DG5_temp RRC DG6_temp RRC DG7_temp Write DG_num_temp into Display RAM Write DG_num_temp into Display RAM 5
The data DG0_temp~ DG9_temp is obtained by looking-up the table which controls the ROW0~ROW9 display. Shift the corresponding data bits as follows: first bit, second bit until the eighth bit in turn and finally get ten new bits of data. Sequentially write them to the corresponding region control the ROW0~ROW9 display, then the data update is complete. Another point to note is the HT16K33 command code Write Flowchart: Write Command Form Example: Enable internal system oscillation HT16K33 I 2 C Start HT16K33 I 2 C Start Send Write Command 0E0H of HT16K33 Send Write Command 0E0H of HT16K33 Move temp_data to I 2 C Bus Move 21H to I 2 C Bus HT16K33 I 2 C Stop HT16K33 I 2 C Stop Note: 1. Uses the page-read method to read the RAM key data and finish reading the data at the address of 40H~45H in one operation. 2. After the HT16K33 command code setup and power on initialisation, the next step is to enable the internal oscillator. 3. The HT16K33 allows any key to wake up the system. 6
PCB Layout Notes The SCL and SDA lines should be parallel and as short as possible. The resistors and capacitors connected to the SCL and SDA lines, which are R5, R6, C6 and C7, should be located as close to the IC as possible. The Reset circuit should be located as close to the IC as possible The power decoupling capacitors, such as C2 (0.1µF) and C5 (0.1µF), which are connected between VDD and VSS, should be located as close to the ICs as possible. The power cables should be as thick as possible and start from the power pin. Connect a capacitor and then to the load. As the pin pitch of the HT16K33 is 25mil, special attention must be made to the trace width. RESET circuit is close to the IC A 104 capacitor is located between the power pin and the IC SCL and SDA Lines are parallel References Refer to the HT16K33 datasheet. Accessory Source Code file. 7