Friday, February 6, 2015

HT1621: a seven segments LCD driver




Abstract
This note resumes the main characteristics of the HT1621 chip that are useful to drive 7-segments displays on Arduino boards.

Main Characteristics
Memory:
32x4 bits RAM (i.e. enough for 32x 7-seg displays with dot)
Operating voltage:
2.4V-5.2V
Power Consumption:
<3mA (@5V)
Power Consumption:
<600μA (@5V with no load, LCD on, internal RC oscillator on)
Clock (built-in):
256kHz RC oscillator
Clock (external):
32kHz quartz oscillator or 256kHZ external input
Comm. interface:
3-wire serial interface
Additional features
Comm. interface:
3-wire serial interface
Tone buzzer:
built-in 2kHz or 4kHz tone buzzer
Data accessing:
three accessing modes
Block diagram
Here is the functional block diagram directly extracted from the Holtek datasheet. In the sequel we will describe each of these blocks.

Figure 1. HT1621: functional block diagram.

Display RAM
This chip has a 32x4 bits static display RAM which is mapped directly to the display driver. Adresses are organized as displayed in Figure 2. The content of the RAM is directly mapped to the content of the LCD driver and may be affected by the commands READ, WRITE, READ-MODIFY-WRITE.
Figure 1. Memory structure of the HT1621. Remark that we have 
restructure the adresses so to be able to take care of a full digit.


System oscillator
The system clock is used in a variety of tasks included LCD driving clock and tone frequency generation. HT1621 has a built-in RC oscillator (256kHZ) and a crystal oscillator (32768Hz). An external 256KHz oscillator can also be used. The type of oscillator used can be selecting by issuing XTAL32K, RC256K or EXT256K commands.
Issuing a SYS_DIS command stops the system clock, the LCD bias generator and the time base/WDT. The LCD screen will appear blank. An LCD_OFF command will turn off the bias generator but not the system clock. Issuing a SYS_DIS command will power down the system reducing power consumption.
Warning: The SYS_DIS command affects the system only when the internal RC 256kHZ or the 32.768kHz crystal clocks are used.

Tone output
The HT1621 can provide a tone output at the pins BZ and BZ. There are only two tone frequencies, namely: 2kHz and 4kHz that can be selected using the TONE2K or TONE4K, respectively. Then, the buzzer (if connected to BZ and BZ) start playing at the TONE_ON command. Sound is stopped issuing the TONE_OFF command.

Power-on
At power-on the system is in SYS_DIS state. A generic LCD initialization sequence will consist of the following steps:
  • Oscillator configuration
  • Bias/com configuration
  • System Enable
  • Bias generator start (LCD_ON)
The library
We have written a library to deal with all the features of HT1621. Since we could test the HT1621 only through a LCD which did not allow to read the on-chip RAM. We provide procedures to software simulate the internal HT1621 internal RAM and have transparent reading procedures. The simulated RAM is used as a default. To change this and use internal HT1621 RAM you need to add
#define __HT1621_READ
right before including the library header file in your sketch.

The test sketch
We provide a very basic sketch for testing the main functions. The pins are connected as follows:
HT1621 Arduino
SS 2
R/W 3
DATA 4


/**
 * \file HT1621-test.ino
 * \brief Simple test sketch for the HT1621 class.
 * \author Enrico Formenti
 * \date 4 february 2015
 * \version 1.0
 * \copyright BSD license, check the License page on the blog for more information. All this text must be
 *  included in any redistribution.
 *  <br><br>
 *  See macduino.blogspot.com for more details.
 */

#include "HT1621.h"

// refere to Macduino website for pin connections and their meaning
HT1621 ht(2,3,4);

void setup() {

  register uint8_t i;
  
  ht.begin();
  
  ht.sendCommand(HT1621::RC256K);
  ht.sendCommand(HT1621::BIAS_THIRD_4_COM);
  ht.sendCommand(HT1621::SYS_EN);
  ht.sendCommand(HT1621::LCD_ON);

  // clear memory
  for(i=0; i<16; i++)
    ht.write(i,0);

  // write all zeroes
  for(i=0; i<16; i++)  
    ht.write(i, 0xBE);
}

void loop() {}

A more comprehensive test set will come with the next post.
Downloads
The library consists in only one header and an implementation files:
And here it is the documentation both in pdf and html (zipped) formats:

Datasheets and application notes
What's next
In the next post we will provide a class for dealing with a generic 7-segments LCD module based on the HT1621 chip with instruction set similar to the classical LiquidCrystal library (here). Finally, a class for a specific 7-seg LCD module that I found at bargains.

Enjoy!

6 comments :

  1. The simulated RAM is used as a default. To change this and use internal HT1621 RAM you need to add
    #define __HT1621_READ: Does this mean that in the default option data is not sent to Chip HT1621 ??

    ReplyDelete
    Replies
    1. Data is always sent to the chip HT1621 on write operations. It is only at reading time that #define __HT1621_READ influences the place from which we read.

      Delete
  2. Hi
    Thanks for you sharing, I create a driver for LCD06BLR that modify from your code, the code place on github.

    https://github.com/eyesblue/LCD06BLR_ArduinoLib

    ReplyDelete