Sunday, February 15, 2015

LiquidCrystal7S: a library for 7 segments LCD based on HT1621 chipset




Abstract

This project aims at implementing the same functionalities as the classical LiquidCrystal library for 7 segments LCD based on the HT1621 chipset. The LCD is supposed to communicate with the HT1621 through a 3-wire or a 4-wire serial protocol. Remark that this wants to be a generic driver, hence only the basic features of 7 segments displays are implemented. All the other features such as displaying special characters or fine tuning should be implemented in a child class. Indeed, the driver is not aware of how memory is mapped to the LCD screen.

Configuration

LCD initialization.The display is initialized with 256KHz internal RC clock frequency, 1/3 Bias and 4 Commons. Refer to the manual of class HT1621 on how to change these settings.

Communication protocol. The communication protocol (3-Wire vs. 4-Wire) is chosen at the constructor level. Using the k-parameters constructor selects the k-Wire protocol.

The examples

As usual, here is a small example for testing the library. The sketch initializes the LCD and then writes a line of symbols 0xBE (this corresponds to '0' on my LCD). The sketch assumes a 12 digits LCD, if you has more (or less) digits please modify the range in the for loop.


/**
 * \file LiquidCrystal7S-test.ino
 * \brief Simple test sketch for the LiquidCrystal7S library.
 * \author Enrico Formenti
 * \date 8 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"
#include "LiquidCrystal7S.h"

// refer to Macduino website for pin connections 
// and their meaning

#define SS 2
#define RW 3
#define DATA 4

LiquidCrystal7S lcd(SS,RW,DATA);

void setup() {
  uint8_t i;
  
  lcd.begin(12, 1);

  // write all zeroes
  for(i=0; i<12; i++)  
    lcd.print((char)0xBE); // remark the cast here
}

void loop() {}

As a second example, here is a sketch which prints a string of three characters 0xBE (a '0' on my LCD).


/**
 * \file LiquidCrystal7S-test.ino
 * \brief Print a string using LiquidCrystal7S library.
 * \author Enrico Formenti
 * \date 8 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"
#include "LiquidCrystal7S.h"

// refer to Macduino website for pin connections 
// and their meaning

#define SS 2
#define RW 3
#define DATA 4

LiquidCrystal7S lcd(SS,RW,DATA);
const char str[] = {0xBE, 0xBE, 0xBE, 0};

void setup() {
  
  lcd.begin(12, 1);

  // write 3 zeroes
  lcd.print(str); // remark the definition of str here
}

void loop() {}

Downloads

The library consists just in the header and implementations files:
The documentation is provided both in html and pdf formats:

No comments :

Post a Comment