- Name : ERM19264_UC1609
- Title : Library for ERM19264-5 v3 LCD (UC1609C controller)
- Description :
- Raspberry pi PICO RP2040 library.
- Inverse, Scroll, rotate and contrast control.
- 10 ASCII fonts included.
- Graphics class included.
- Sleep mode.
- Bitmaps supported.
- Hardware SPI options
- Polymorphic print class included to print many data types.
- Port of my arduino library , More details there.
- Author: Gavin Lyons
- Developed on
- Raspberry pi PICO RP2040
- SDK C++ compiler G++ for arm-none-eabi
- CMAKE , VScode
9 pins , Vcc and GND, anode and cathode for the backlight LED and an SPI interface. The backlight control is left up to user. The CLK and Data lines are fixed to the SPI interface but any GPIO can be used for reset, DC and CS.
There are 3 different colours in range, Parts used purchased from ebay
- ERM19264SBS-5 V3 LCD Display UC1609C controller , white on blue
- ERM19264FS-5 V3 LCD Display UC1609C controller , black on white
- 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.
The Software is commented mostly for "doxygen" and if users uses "doxygen" software an API document can be generated. A Doxyfile is in "doc" sub folder in repository.
Hardware SPI. The hardware SPI speed is set at 8MHz you can change this if necessary by changing LCDSPISetup method arguments. Spi0 is used in example files but can be changed by passing a different SPI channel.(Spi0 or Spi1)
There are 10 fonts packaged with library. Fonts can be easily added or removed by user. All the Font data is in the font files.
Font data table:
num | Font pointer name | character size XxY | ASCII range | Size in bytes |
---|---|---|---|---|
1 | pFontDefault | 6x8 | 0 - 0xFE, Full Extended | 1534 |
2 | pFontWide | 9x8 | 0x20 - 0x5A, NO lowercase letters | 535 |
3 | pFontPico | 4x6 | 0x20 - 0x7E | 289 |
4 | pFontSinclairS | 8x8 | 0x20 - 0x7E | 764 |
5 | pFontMega | 16x16 | 0x20 - 0x7E | 3044 |
6 | pFontArialBold | 16x16 | 0x20 - 0x7E | 3044 |
7 | pFontHallfetica | 16x16 | 0x20 - 0x7E | 3044 |
8 | pFontArialRound | 16x24 | 0x20 - 0x7E | 4564 |
9 | pFontGroTesk | 16x32 | 0x20 - 0x7A | 5828 |
10 | pFontSixteenSeg | 32x48 | 0x2D-0x3A , 0-10 : . / - only | 2692 |
Font size in bytes = ((X * (Y/8)) * numberOfCharacters) + (4*ControlByte)
Font class Function | Notes |
---|---|
writeChar | draws single character |
writeCharString | draws character array |
Polymorphic print class which will print out many data types |
These methods return an error code in event of an error such as, ASCII character outside chosen fonts range, character out of screen bounds and invalid character array pointer object.
Remove a font
To remove an unwanted font from project simply comment out or delete.
- The Font data in ERM19264_UC1609_font.cpp file
- The pointer to font at bottom of ERM19264_UC1609_font.cpp file
- The associated extern pointer declaration in the ERM19264_UC1609_font.hpp file
Adding a new font
- Add the Font data in ERM19264_UC1609_font.cpp file
- Add a pointer to font at bottom of ERM19264_UC1609_font.cpp file
- Add an associated extern pointer declaration in the ERM19264_UC1609_font.hpp file
The new ASCII font must have following font structure. First 4 bytes are control bytes followed by vertically addressed font data.
// An 4 by 8 character size font starting at
// ASCII offset 0x30 in ASCII table with 0x02 characters in font.
// 0 and 1
static const uint8_t FontBinaryExample[] =
{
0x04, 0x08, 0x30, 0x02, // x-size, y-size, offset, total characters
(data),(data),(data),(data) // font data '0'
(data),(data),(data),(data) // font data '1'
}
Some of the fonts packaged with library came from URL. If user has picture of a font like so.
There is a monochrome font maker there at URL
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 | LCDBufferScreen() | Vertical | For internal use mostly |
3 | drawBitmap() | Vertical | default, setDrawBitmapAddr(true) |
4 | drawBitmap() | Horizontal | setDrawBitmapAddr(false) |
The drawBitmap method will return an error if : The Bitmap is completely off screen , Invalid Bitmap pointer object, bitmap bigger than screen , bitmap bigger/smaller than provided width and height calculation ( This helps prevents buffer overflow). A vertical addressed Bitmap's height must be divisible by 8. eg, for a bitmap with width=128 and height=64. Bitmap excepted size = 128 * (64/8) = 1024 bytes. A horizontal addressed Bitmap's width must be divisible by 8. eg, for a bitmap with width=88 and height=48. Bitmap excepted size = (88/8) * 48 = 528 bytes.
Bitmaps can be turned to data here at link See example file "BITMAP" for more details.
If the LCD does not initialize correctly. Try adjusting the RAM address control setting from 0x02(default) to 0x01. See github issue 4(arduino Source port) for details. Users can adjust setting in the "begin" method argument list. This setting changes bits 2-0 in AC register, see diagram below for details.
When the user calls LCDinit() 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 LCDinit | PM 7:0 |
Ram Address Control | 0x02 | Set by user with LCDinit | AC 2:0 |
X = ERM19264_UC1609 in tables below
Src Files | Description |
---|---|
X.hpp | library header file |
X.cpp | library source file |
X_graphics.hpp | graphics header file |
X_graphics.cpp | graphics source file |
X_font.hpp | font header file |
X_font.cpp | font data file |
X_print.hpp | used for printing data types |
X_print.cpp | used for printing data types |
The example files are in example folder. To build the one you want, edit the Cmaketxt file add_executable(${PROJECT_NAME} section, comment in one example file path and one only. The default is the Hello world one.
Examples files main.cpp | Description |
---|---|
X_HELLO | Hello world , Basic usage |
X_TEXT_GRAPHICS | Text + graphics |
X_FUNCTIONS_FPS | FPS test & misc functions, rotate , scroll, etc |
X_BITMAP | Shows use of bitmaps methods |