This section covers GLCD devices that use the UC1601 graphics controller.
The UC1601 is an advanced high-voltage mixed signal CMOS IC, especially designed for the display needs of ultra-low power hand-held devices.
The UC1601 embeds with contrast control, display RAM and oscillator, which reduces the number of external components and power consumption. It has 256-step brightness control. Data/Commands are sent from general MCU through the hardware selectable 6800/8000 series compatible Parallel Interface, I2C interface or Serial Peripheral Interface. It is suitable for many compact portable applications, such as mobile phone sub-display, MP3 player and calculator, etc.
The UC1601 library supports 132 * 22 pixels. The UC1601 library supports monochrome devices.
The UC1601 can operate in three modes. Full GLCD mode, Low Memory GLCD mode or Text/JPG mode the full GLCD mode requires a minimum of 396 bytes or 128 bytes for the respective modes. For microcontrollers with limited memory the third mode of operation - Text mode. These can be selected by setting the correct constant.
To use the UC1601 driver simply include the following in your user code. This will initialise the driver.
The GCBASIC constants shown below control the configuration of the UC1601 controller. GCBASIC supports hardware I2C & software I2C connectivity - this is shown in the tables below.
To use the UC1601 drivers simply include one of the following configuration.
'An I2C configuration #include <glcd.h> #define GLCD_TYPE GLCD_TYPE_UC1601 #define GLCD_I2C_Address 0x70 'I2C address #define GLCD_RESET portc.0 'Hard Reset pin connection #define GLCD_PROTECTOVERRUN #define GLCD_OLED_FONT ; ----- Define Hardware settings for I2C ' Define I2C settings - CHANGE PORTS #define I2C_MODE Master #define I2C_DATA PORTb.5 #define I2C_CLOCK PORTb.7 #define I2C_DISABLE_INTERRUPTS ON
The GCBASIC constants for control display characteristics are shown in the table below.
Constants | Controls | Options |
---|---|---|
|
|
Required |
|
I2C address of the GLCD. |
Fixed at 0x70. |
The GCBASIC constants for control display characteristics are shown in the table below.
Constants | Controls | Default |
---|---|---|
|
The width parameter of the GLCD |
|
|
The height parameter of the GLCD |
|
|
Define this constant to restrict pixel operations with the pixel limits |
Recommended |
|
Specifies that the display controller will operate in text mode and BMP
draw mode only. |
Optional |
|
Specifies that the display controller will operate in Low Memory mode. |
Optional |
|
Specifies the use of the optional OLED font set. The GLCDfntDefaultsize can be set to 1 or 2 only.
|
Optional |
The GCBASIC variables for control display characteristics are shown in the table below. These variables control the user definable parameters of a specific GLCD.
Variable | Purpose | Type |
---|---|---|
|
GLCD background state. |
A monochrome value. |
|
Color of GLCD foreground. |
A monochrome value. |
|
Width of the current GLCD font. |
Default is 6 pixels. |
|
Size of the current GLCD font. |
Default is 0. This equates to the standard GCB font set. |
|
Size of the current GLCD font. |
Default is 1. This equates to the 8 pixel high. |
The GCBASIC commands supported for this GLCD are shown in the table below.
Command | Purpose | Example |
---|---|---|
|
Clear screen of GLCD |
|
|
Print string of characters on GLCD using GCB font set |
|
|
Print character on GLCD using GCB font set |
|
|
Print characters on GLCD using GCB font set |
|
|
Draw a box on the GLCD to a specific size |
|
|
Draw a box on the GLCD to a specific size that is filled with the foreground colour. |
|
|
Draw a line on the GLCD to a specific length that is filled with the specific attribute. |
|
|
Set a pixel on the GLCD at a specific position that is set with the specific attribute. |
|
|
Commence a series of GLCD commands when in low memory mode. Must be followed a |
|
|
Commence a series of GLCD commands when in low memory mode. Must follow a |
|
|
Send command instruction to GLCD. Handles I2C and SPI protocols. |
Transaction must be closed by using |
|
Send data instruction to GLCD. Handles I2C and SPI protocols. |
Transaction must be closed by using |
|
Send transactional, a stream of, data to GLCD. |
Transaction must be opened and closed by using transaction commands. |
|
Close the communications to the GLCD. |
Transaction must be opened by using |
The GCBASIC specific commands for this GLCD are shown in the table below.
Command | Purpose |
---|---|
|
Stops all scrolling |
|
Activates a vertical scroll for rows start. |
|
Sets the constrast between 0 and 255. The contrast increases as the value increases. |
For a UC1601 datasheet, please refer here.
This example shows how to drive a UC1601 based Graphic I2C LCD module with the built in commands of GCBASIC using Full Mode GLCD
; ----- Configuration #chip 16f18446, 32 #option explicit ; ----- Define GLCD Hardware settings #include <glcd.h> #define GLCD_TYPE GLCD_TYPE_UC1601 #define GLCD_I2C_Address 0x70 'I2C address #define GLCD_RESET portc.0 'Hard Reset pin connection #define GLCD_PROTECTOVERRUN #define GLCD_OLED_FONT ; ----- Define Hardware settings ' Define I2C settings - CHANGE PORTS #define I2C_MODE Master #define I2C_DATA PORTb.5 #define I2C_CLOCK PORTb.7 #define I2C_DISABLE_INTERRUPTS ON ; ----- Define variables ; ----- Main program 'You can treat the GLCD like an LCD.... GLCDPrintStringLN "User the GLCD like an LCD...." GLCDPrintStringLN "The GLCDPrintString commands...." GLCDPrintString "Enjoy....." wait 4 s end
This example shows how to drive a UC1601 based Graphic I2C LCD module with the built in commands of GCBASIC using Low Memory
Mode GLCD.
Note the use of GLCD_Open_PageTransaction
and GLCD_Close_PageTransaction
to support the Low Memory Mode of operation and the contraining of all GLCD commands with the transaction commands. The
use Low Memory Mode GLCD the two defines GLCD_TYPE_UC1601_LOWMEMORY_GLCD_MODE
and GLCD_TYPE_UC1601_CHARACTER_MODE_ONLY
are included in the user program.
#chip mega328p,16 #include <glcd.h> ; ----- Define Hardware settings ' Define I2C settings #define HI2C_BAUD_RATE 400 #define HI2C_DATA HI2CMode Master ; ----- Define GLCD Hardware settings #define GLCD_TYPE GLCD_TYPE_UC1601 #define GLCD_TYPE_UC1601_LOWMEMORY_GLCD_MODE #define GLCD_TYPE_UC1601_CHARACTER_MODE_ONLY dim outString as string * 21 GLCDCLS 'To clarify - page udpates '0,7 correspond with the Text Lines from 0 to 3 on a 22 Pixel Display 'In this example Code would be GLCD_Open_PageTransaction 0,1 been enough 'But it is allowed to use GLCD_Open_PageTransaction 0,3 to show the full screen update GLCD_Open_PageTransaction 0,3 GLCDPrint 0, 0, "GCBASIC" GLCDPrint (0, 16, "Anobium 2021") GLCD_Close_PageTransaction end
For more help, see GLCDCLS, GLCDDrawChar, GLCDPrint, GLCDReadByte, GLCDWriteByte or Pset
Supported in <GLCD.H>