Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gavinlyonsrepo/erm19264_uc1609

Arduino Eco-system Library to Support the ERM19264 LCD driven by the UC1609C / UC1609 controller.
https://github.com/gavinlyonsrepo/erm19264_uc1609

arduino arduino-library bluepill display display-library erm erm19264 esp32 esp8266 lcd lcd-display library liquidcrystal spi st7525 stm32 stm32bluepill stm32f103c8t6 uc1609 uc1609c

Last synced: 3 days ago
JSON representation

Arduino Eco-system Library to Support the ERM19264 LCD driven by the UC1609C / UC1609 controller.

Awesome Lists containing this project

README

        

[![Website](https://img.shields.io/badge/Website-Link-blue.svg)](https://gavinlyonsrepo.github.io/) [![Rss](https://img.shields.io/badge/Subscribe-RSS-yellow.svg)](https://gavinlyonsrepo.github.io//feed.xml) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/paypalme/whitelight976)

![ ERM19264 LCD image ](https://github.com/gavinlyonsrepo/ERM19264_UC1609/blob/main/extras/image/color.jpg)

# ERM19264_UC1609

## Table of contents

* [Overview](#overview)
* [Output](#output)
* [Installation](#installation)
* [Hardware](#hardware)
* [Software](#software)
* [API Documentation](#api-documentation)
* [SPI](#spi)
* [Buffer](#buffer)
* [Fonts](#fonts)
* [Bitmaps](#bitmaps)
* [User adjustments](#user-adjustments)
* [Example files](#example-files)
* [Tested MCU](#tested-mcu)

## Overview

* Name : ERM19264_UC1609
* Title : Library for ERM19264-5 v3 LCD (UC1609C controller) for the Arduino eco-system
* Description :

1. Arduino eco-system library.
2. Inverse, Scroll, rotate and contrast control.
3. 12 ASCII fonts included.
4. Graphics class included.
5. Sleep mode.
6. Multi-screen shared buffer mode.
7. Bitmaps supported.
8. Hardware & software SPI options
9. Light weight basic text version [here at link](https://github.com/gavinlyonsrepo/ERM19264_UC1609_TEXT).
10. Software may also work with ERM19264 LCD controlled by ST7525 controller but untested at current time.
* Author: Gavin Lyons
* URL : [Github URL link](https://github.com/gavinlyonsrepo/ERM19264_UC1609)

## Output

Output Screenshots, From left to right top to bottom.

1. Full screen bitmap displayed
2. Multi-screen shared buffer mode, In this case screen divided into two.
3. Different size and inverted default font
4. ASCII font 1-127 printed out with default font size 1
5. Fonts 7-8
6. Fonts 1-4

![output image 1](https://github.com/gavinlyonsrepo/ERM19264_UC1609/blob/main/extras/image/output.jpg)

![output image 2](https://github.com/gavinlyonsrepo/ERM19264_UC1609/blob/main/extras/image/output2.jpg)

## Installation

The library is included in the official Arduino library manger and the optimum way to install it is using the library manager which can be opened by the *manage libraries* option in Arduino IDE.

## Hardware

9 pins , Vcc and GND, anode and cathode for the backlight LED and an SPI interface.
The example files are setup for an UNO for the pin connections used by for other MCU tested see extras folder GPIO_MCU_used.txt file. The backlight control is left up to user.
If using Hardware SPI two of pins will be tied to the SPI CLK and MOSI lines if using software SPI you should be able use any GPIO you want for all five pins.
Datasheet links are in the extras folder.

There are 3 different colours in range, Parts used purchased from [ebay](https://www.ebay.ie/itm/2-inch-White-192x64-Graphic-LCD-Display-Module-UC1609-SPI-for-Arduino/293617684779?hash=item445cfa512b:g:10MAAOSwYV9e6xsi)

1. ERM19264SBS-5 V3 LCD Display UC1609C controller , white on blue
2. ERM19264FS-5 V3 LCD Display UC1609C controller , black on white
3. ERM19264DNS-5 V3 LCD Display UC1609C controller white on black

The library was tested on 1 and 2.

This wiring Diagram from the manufacturer showing hardware setup connected to an ~8051 MCU, showing both 3.3 volt and 5 volt systems.

![ ERM19264 wiring image ](https://github.com/gavinlyonsrepo/ERM19264_UC1609/blob/main/extras/image/connect.jpg)

## Software

### API Documentation

The API (application programming interface) documentation is at link hosted on github pages and generated by Doxygen.

[API URL](https://gavinlyonsrepo.github.io/misc/software_docs/ERM19264_UC1609/index.html)

### SPI

Hardware and software SPI. Two different class constructors. User can pick the relevant constructor, see examples files. When running Software SPI it may be necessary on very high frequency MCU's to change the SW SPI GPIO delay(LCDHighFreqDelaySet) It is a microsecond delay by default it is at 0. All the hardware SPI settings are defined in the header file and can be easily changed if necessary. It should be able to share SPI bus with other SPI devices on different SPI settings.

### Buffer

The library features a multi-screen shared buffer mode, In order to save data memory for devices with
low data memory. For example if user defines a buffer to cover the whole screen it takes 1536 bytes of data memory. Instead a user (for example) can create a buffer that covers half the screen for just 768 bytes then define two screens objects each pointing to the same buffer.
The user uses the 'ERM19264_UC1609_Screen' Class objects to define each screen
and the 'ActiveBuffer' pointer to switch the buffer between each screen. Multiple screens of same size can be created so LCD screen can be divided into thirds or quarters saving even more memory. The disadvantage of this is the code is slightly more complicated and user can only write to one screen at a time. If user does not want to use multi screen mode they can simply just define ONE screen to cover entire LCD screen. See example files and API for more detail.

Figure :: The class structure with three screen object's and active buffer presently pointing to number one.

![ ERM19264 class image ](https://github.com/gavinlyonsrepo/ERM19264_UC1609/blob/main/extras/image/screenmode.png)

### Fonts

Font data table:

| num | enum name | Char size XbyY | ASCII range | Size bytes | Size Scale-able |
| ------ | ------ | ------ | ------ | ------ | ----- |
| 1 | $_Default | 5x8 |0-0x7F|635 |Y|
| 2 | $_Thick | 7x8 |0x20-0x5A, no lowercase letters |406|Y|
| 3 | $_SevenSeg | 4x8 |0x20-0x7A |360|Y|
| 4 | $_Wide | 8x8 |0x20-0x5A, no lowercase letters|464|Y|
| 5 | $_Tiny | 3x8 |0x20-0x7E |285|Y|
| 6 | $_Homespun | 7x8 |0x20-0x7E |658|Y|
| 7 | $_Bignum | 16x32 |0x2D-0x3A ,0-10 - . / : |896|N|
| 8 | $_Mednum | 16x16 |0x2D-0x3A ,0-10 - . / :|448|N|
| 9 | $_ArialRound| 16x24 | 0x20-0x7E |4608|N|
| 10 | $_ArialBold | 16x16 |0x20-0x7E |3072|N|
| 11 | $_Mia| 8x16 | 0x20-0x7E |1520|N|
| 12 | $_Dedica | 6x12 |0x20-0x7E |1152|N|

1. $ = UC1609Font
2. Fonts 1-6 are byte high(at text size 1) scale-able fonts, columns of padding added by SW.
3. Font 7-8 are large numerical fonts and cannot be scaled(just one size).
4. Fonts 9-12 Alphanumeric fonts and cannot be scaled(just one size)

Font Methods:

| Font num | Method | Size parameter | Notes |
| ------ | ------ | ------ | ------ |
| 1-6 | drawChar|Y| draws single character |
| 1-6 | drawText |Y| draws character array |
| 7-12 | drawChar|N| draws single character |
| 7-12 | drawText|N| draws character array |
| 1-12 | print |~| Polymorphic print class which will print out many data types(arduino built in) |

These functions return a enum( LCD_Return_Codes_e), non-zero in event of an error, see API doc.
By default only Font 1 is commented in and ready to go to save memory.
So to use a non-default Font (2-12), two steps. Comment in the respective define at top of library header file ERM19264_UC1609_graphics_font.h in the USER FONT OPTION ONE section
Call SetFontNum method and pass it name of respective font. eg SetFontNum(UC1609Font_Wide).

### Bitmaps

There is a few different ways of displaying bitmaps,

| Num | Method | Data addressing | Note |
| ------ | ------ | ------- | ------ |
| 1 | LCDBitmap() | Vertical | Writes directly to screen , no buffer used. |
| 2 | LCDBuffer() | Vertical | Mostly for internal use ... mostly |
| 3 | buffer init technique | Vertical | Can be used when initialising a buffer, splash screen |
| 4a | drawBitmap() | Vertical | default, setDrawBitmapAddr(true) |
| 4b | drawBitmap() | Horizontal | setDrawBitmapAddr(false) |

The drawBitmap function will return an enum with an error code if an error occurs see API docs.
See the bitmap example file for more details on each method. Bitmaps can be turned to data [here at link]( https://javl.github.io/image2cpp/) , Bitmaps should be defined in the program memory and buffers in the data memory.

### User adjustments

Some users have reported the LCD not initialising correctly with this software.
It was found that by adjusting the RAM address control setting from 0x02 to 0x01.
it resolved problem. See github issue 4 for details. I suspect the root cause is different versions of product on market. As of Version 1.7 users can adjust setting in the "begin" method argument list.
This setting changes bits 2-0 in AC register, see diagram below for details.

![ ERM19264 ram image ](https://github.com/gavinlyonsrepo/ERM19264_UC1609/blob/main/extras/image/ram.png)

When the user calls LCDbegin() to start LCD they can specify a contrast setting from 0x00 to 0xFF.
Datasheet says 0x49 is default. (VbiasPOT). Lower contrast works better on the blue color version.

It is also possible for user to change LCD bias , Temperature coefficient, frame rate and power control but this must be done by changing defines in header file. Choose lower frame rate for lower power, and choose higher frame rate to improve LCD contrast and minimize flicker. See Data sheet for range of values here. Defaults where found to be fine during all testing of this library.

| Parameter | default Values | Define | Register bits |
| ------ | ------ | ------ | ------ |
| LCD bias | 9 | BIAS_RATIO_SET | BR 1:0 |
| Temp coefficient | -0.00%/ C | TEMP_COMP_SET | TC 1:0 |
| Frame rate | 95 fps | FRAMERATE_SET | LC 4:3 |
| Power control | 1.4mA + Internal VLCD (7x charge pump) | PC_SET | PC 2:0 |
| V bias Bot(contrast) | 0x49 | Set by user with LCDbegin | PM 7:0 |
| Ram Address Control | 0x02 | Set by user with LCDbegin | AC 2:0 |

### Example files

| Examples files ino | Description |
| ------ | ------ |
| BITMAP | Shows use of bitmaps |
| GRAPHICS | Tests use of graphics |
| MISC | Shows misc functions, rotate, invert etc |
| MULTISCREEN| Shows use of multi screen mode + FPS, two screens |
| MULTISCREEN_TWO | Shows use of multi screen mode, four screens |
| TEXT | Shows use of text and fonts, All Fonts must be enabled to work fully |
| SWSPI | Shows use of software SPI |
| HELLO | Hello world, basic use case |

## Tested MCU

Tested on following MCUs both software and hardware SPI,
The example files are setup for an UNO for the pin connections used
by for other MCU testing see extras/doc folder GPIO_MCU_used.txt file.

1. Arduino UNO & NANO v3
2. ESP8266
3. ESP32
4. STM32 "blue pill"
5. UNO Minima R4

## Notes and Issues