T6963C Graphic Lcd Library
The mikroPascal PRO for ARM provides a library for working with Glcds based on TOSHIBA T6963C controller. The Toshiba T6963C is a very popular Lcd controller for the use in small graphics modules. It is capable of controlling displays with a resolution up to 240x128. Because of its low power and small outline it is most suitable for mobile applications such as PDAs, MP3 players or mobile measurement equipment. Although small, this contoller has a capability of displaying and merging text and graphics and it manages all the interfacing signals to the displays Row and Column drivers.
For creating a custom set of Glcd images use Glcd Bitmap Editor Tool.

- When using this library with ARM family of MCUs be aware of their voltage incompatibility with certain number of T6963C based Glcd modules. So, additional external power supply for these modules may be required.
- ChipEnable(CE), FontSelect(FS) and Reverse(MD) have to be set to appropriate levels by the user outside of the T6963C_Init() function. See the Library Example code at the bottom of this page.
- Glcd size based initialization routines can be found in setup library files located in the Uses folder.
- The user must make sure that used MCU has appropriate ports and pins. If this is not the case the user should adjust initialization routines.
Some mikroElektronika's adapter boards have pinout different from T6369C datasheets. Appropriate relations between these labels are given in the table below :
Adapter Board | T6369C datasheet |
---|---|
RS | C/D |
R/W | /RD |
E | /WR |
Library Dependency Tree

External dependencies of T6963C Graphic Lcd Library
Stellaris
The following variables must be defined in all projects using T6963C Graphic Lcd library: | Description : | Example : |
---|---|---|
var T6963C_dataPort : dword; sfr; external; |
T6963C Data Port. | var T6963C_dataPort : byte at GPIO_PORTE_DATA; |
var T6963C_ctrlwr : sbit; sfr; external; |
Write signal. | var T6963C_ctrlwr : sbit at GPIO_PORTD_DATA2_bit; |
var T6963C_ctrlrd : sbit; sfr; external; |
Read signal. | var T6963C_ctrlrd : sbit at GPIO_PORTD_DATA1_bit; |
var T6963C_ctrlcd : sbit; sfr; external; |
Command/Data signal. | var T6963C_ctrlcd : sbit at GPIO_PORTD_DATA0_bit; |
var T6963C_ctrlrst : sbit; sfr; external; |
Reset signal. | var T6963C_ctrlrst : sbit at GPIO_PORTD_DATA4_bit; |
var T6963C_ctrlwr_Direction : sbit; sfr; external; |
Direction of the Write pin. | var T6963C_ctrlwr_Direction : sbit at GPIO_PORTD_DIR2_bit; |
var T6963C_ctrlrd_Direction : sbit; sfr; external; |
Direction of the Read pin. | var T6963C_ctrlrd_Direction : sbit at GPIO_PORTD_DIR1_bit; |
var T6963C_ctrlcd_Direction : sbit; sfr; external; |
Direction of the Command/Data pin. | var T6963C_ctrlcd_Direction : sbit at GPIO_PORTD_DIR0_bit; |
var T6963C_ctrlrst_Direction : sbit; sfr; external; |
Direction of the Reset pin. | var T6963C_ctrlrst_Direction : sbit at GPIO_PORTD_DIR4_bit; |
STM32
The following variables must be defined in all projects using T6963C Graphic Lcd library: | Description : | Example : |
---|---|---|
var T6963C_dataPort_Input : dword; sfr; external; |
T6963C Data Input Port. | var T6963C_dataPort_Input : dword at GPIOD_IDR; |
var T6963C_dataPort_Output : dword; sfr; external; |
T6963C Data Output Port. | var T6963C_dataPort_Output : dword at GPIOD_ODR; |
var T6963C_ctrlwr : sbit; sfr; external; |
Write signal. | var T6963C_ctrlwr : sbit at GPIOD_ODR.B8; |
var T6963C_ctrlrd : sbit; sfr; external; |
Read signal. | var T6963C_ctrlrd : sbit at GPIOD_ODR.B9; |
var T6963C_ctrlcd : sbit; sfr; external; |
Command/Data signal. | var T6963C_ctrlcd : sbit at GPIOD_ODR.B11; |
var T6963C_ctrlrst : sbit; sfr; external; |
Reset signal. | var T6963C_ctrlrst : sbit at GPIOD_ODR.B12; |
Library Routines
- T6963C_init
- T6963C_writeData
- T6963C_writeCommand
- T6963C_setPtr
- T6963C_Set_Ext_Buffer
- T6963C_waitReady
- T6963C_fill
- T6963C_dot
- T6963C_Set_Font_Adv
- T6963C_Set_Font_Ext_Adv
- T6963C_write_char
- T6963C_Write_Char_Adv
- T6963C_write_text
- T6963C_Write_Text_Adv
- T6963C_line
- T6963C_rectangle
- T6963C_Rectangle_round_edges
- T6963C_Rectangle_round_edges_fill
- T6963C_box
- T6963C_circle
- T6963C_Circle_fill
- T6963C_image
- T6963C_Ext_Image
- T6963C_PartialImage
- T6963C_Ext_PartialImage
- T6963C_sprite
- T6963C_set_cursor
- T6963C_displayGrPanel
- T6963C_displayTxtPanel
- T6963C_setGrPanel
- T6963C_setTxtPanel
- T6963C_panelFill
- T6963C_grFill
- T6963C_txtFill
- T6963C_cursor_height
- T6963C_graphics
- T6963C_text
- T6963C_cursor
- T6963C_cursor_blink
T6963C_init
Prototype |
procedure T6963C_init(width, height, fntW : word); |
---|---|
Description |
Initalizes the Graphic Lcd controller. Display RAM organization:The library cuts the RAM into panels : a complete panel is one graphics panel followed by a text panel (see schematic below). +---------------------+ /\ + GRAPHICS PANEL #0 + | + + | + + | + + | +---------------------+ | PANEL 0 + TEXT PANEL #0 + | + + \/ +---------------------+ /\ + GRAPHICS PANEL #1 + | + + | + + | + + | +---------------------+ | PANEL 1 + TEXT PANEL #1 + | + + | +---------------------+ \/ |
Parameters |
|
Returns |
Nothing. |
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
Stellaris// T6963C module connections var T6963C_dataPort : byte at GPIO_PORTE_DATA; // DATA port var T6963C_ctrlwr : sbit at GPIO_PORTD_DATA2_bit; // WR write signal var T6963C_ctrlrd : sbit at GPIO_PORTD_DATA1_bit; // RD read signal var T6963C_ctrlcd : sbit at GPIO_PORTD_DATA0_bit; // CD command/data signal var T6963C_ctrlrst : sbit at GPIO_PORTD_DATA4_bit; // RST reset signal var T6963C_ctrlwr_Direction : sbit at GPIO_PORTD_DIR2_bit; // WR write signal direction var T6963C_ctrlrd_Direction : sbit at GPIO_PORTD_DIR1_bit; // RD read signal direction var T6963C_ctrlcd_Direction : sbit at GPIO_PORTD_DIR0_bit; // CD command/data signal direction var T6963C_ctrlrst_Direction : sbit at GPIO_PORTD_DIR4_bit; // RST reset signal direction // Signals not used by library, they are set in main function var T6963C_ctrlce : sbit at GPIO_PORTD_DATA3_bit; // CE signal var T6963C_ctrlfs : sbit at GPIO_PORTD_DATA6_bit; // FS signal var T6963C_ctrlmd : sbit at GPIO_PORTD_DATA5_bit; // MD signal var T6963C_ctrlce_Direction : sbit at GPIO_PORTD_DIR3_bit; // CE signal direction var T6963C_ctrlfs_Direction : sbit at GPIO_PORTD_DIR6_bit; // FS signal direction var T6963C_ctrlmd_Direction : sbit at GPIO_PORTD_DIR5_bit; // MD signal direction // End T6963C module connections ... // init display for 240 pixel width, 128 pixel height and 8 bits character width T6963C_init(240, 128, 8); STM32// T6963C module connections var T6963C_dataPort_Output : dword at GPIOD_ODR; // DATA port var T6963C_dataPort_Input : dword at GPIOD_IDR; // DATA port var T6963C_ctrlwr : sbit at GPIOD_ODR.B8; // WR write signal var T6963C_ctrlrd : sbit at GPIOD_ODR.B9; // RD read signal var T6963C_ctrlcd : sbit at GPIOD_ODR.B11; // CD command/data signal var T6963C_ctrlrst : sbit at GPIOD_ODR.B12; // RST reset signal // Signals not used by library, they are set in main function var T6963C_ctrlce : sbit at GPIOD_ODR.B10; // CE signal var T6963C_ctrlfs : sbit at GPIOD_ODR.B13; // FS signal // End T6963C module connections ... // init display for 240 pixel width, 128 pixel height and 8 bits character width T6963C_init(240, 128, 8); |
Notes |
None. |
T6963C_writeData
Prototype |
procedure T6963C_writeData(mydata : byte); |
---|---|
Description |
Writes data to T6963C controller. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_writeData(AddrL); |
Notes |
None. |
T6963C_writeCommand
Prototype |
procedure T6963C_writeCommand(mydata : byte); |
---|---|
Description |
Writes command to T6963C controller. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_writeCommand(T6963C_CURSOR_POINTER_SET); |
Notes |
None. |
T6963C_setPtr
Prototype |
procedure T6963C_setPtr(p : word; c : byte); |
---|---|
Description |
Sets the memory pointer |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_setPtr(T6963C_grHomeAddr + start, T6963C_ADDRESS_POINTER_SET); |
Notes |
None. |
T6963C_Set_Ext_Buffer
Prototype |
procedure T6963C_Set_Ext_Buffer(getExtDataPtr : ^TT6963C_Get_Ext_Data_Ptr); |
---|---|
Returns |
Nothing. |
Description |
Function sets pointer to the user function which manipulates the external resource. Parameters :
User function prototype should be in the following format: Parameters used in the function have the following meaning :
|
Requires |
Glcd module needs to be initialized. See the T6963C_Init routine. |
Example |
T6963C_Set_Ext_Buffer(@ReadExternalBuffer); |
T6963C_waitReady
Prototype |
procedure T6963C_waitReady(); |
---|---|
Description |
Pools the status byte, and loops until Toshiba Glcd module is ready. |
Parameters |
None. |
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_waitReady(); |
Notes |
None. |
T6963C_fill
Prototype |
procedure T6963C_fill(v : byte; start, len : word); |
---|---|
Description |
Fills controller memory block with given byte. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_fill(0x33,0x00FF,0x000F); |
Notes |
None. |
T6963C_dot
Prototype |
procedure T6963C_dot(x, y : integer; color : byte); |
---|---|
Description |
Draws a dot in the current graphic panel of Glcd at coordinates (x, y). |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_dot(x0, y0, pcolor); |
Notes |
None. |
T6963C_Set_Font_Adv
Prototype |
procedure T6963C_Set_Font_Adv(const activeFont : ^byte; font_color : word; font_orientation : byte); |
---|---|
Description |
Sets font that will be used with T6963C_Write_Char_Adv and T6963C_Write_Text_Adv routines. |
Parameters |
|
Returns |
Nothing. |
Requires |
Glcd needs to be initialized, see T6963C_Init routine. |
Example |
T6963C_Set_Font_Adv(@myfont, 0, 0); |
Notes |
None. |
T6963C_Set_Ext_Font_Adv
Prototype |
procedure T6963C_Set_Ext_Font_Adv(activeFont : dword; font_color : word; font_orientation : word); |
---|---|
Description |
Sets font that will be used with T6963C_Write_Char_Adv and T6963C_Write_Text_Adv routines. Font is located in an external resource. |
Parameters |
|
Returns |
Nothing. |
Requires |
Glcd needs to be initialized, see T6963C_Init routine. |
Example |
T6963C_Set_Ext_Font_Adv(173296, 0, 0); |
Notes |
None. |
T6963C_write_char
Prototype |
procedure T6963C_write_char(c, x, y, mode : byte); |
---|---|
Description |
Writes a char in the current text panel of Glcd at coordinates (x, y). |
Parameters |
Mode parameter explanation:
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_write_char('A',22,23,T6963C_ROM_MODE_AND); |
Notes |
None. |
T6963C_write_char_adv
Prototype |
procedure T6963C_Write_Char_Adv(ch, x, y : word); |
---|---|
Description |
Writes a char in the current text panel of Glcd at coordinates (x, y). |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_write_char_adv('A',22,23); |
Notes |
None. |
T6963C_write_text
Prototype |
procedure T6963C_write_text(var str : string; x, y, mode : byte); |
---|---|
Description |
Writes text in the current text panel of Glcd at coordinates (x, y). |
Parameters |
Mode parameter explanation:
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_write_text('GLCD LIBRARY DEMO, WELCOME !', 0, 0, T6963C_ROM_MODE_XOR); |
Notes |
None. |
T6963C_Write_Text_Adv
Prototype |
procedure T6963C_Write_Text_Adv(var text : string; x, y : word); |
---|---|
Description |
Writes text in the current text panel of Glcd at coordinates (x, y). |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_Write_Text_Adv("Glcd LIBRARY DEMO, WELCOME !", 0, 0); |
Notes |
None. |
T6963C_line
Prototype |
procedure T6963C_line(x0, y0, x1, y1 : integer; pcolor : byte); |
---|---|
Description |
Draws a line from (x0, y0) to (x1, y1). |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_line(0, 0, 239, 127, T6963C_WHITE); |
Notes |
None. |
T6963C_rectangle
Prototype |
procedure T6963C_rectangle(x0, y0, x1, y1 : integer; pcolor : byte); |
---|---|
Description |
Draws a rectangle on Glcd. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_rectangle(20, 20, 219, 107, T6963C_WHITE); |
Notes |
None. |
T6963C_rectangle_round_edges
Prototype |
procedure T6963C_rectangle_round_edges(x0, y0, x1, y1, radius : integer; pcolor : byte); |
---|---|
Description |
Draws a rounded edge rectangle on Glcd. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
Example |
T6963C_rectangle_round_edges(20, 20, 219, 107, 12, T6963C_WHITE); |
Notes |
None. |
T6963C_rectangle_round_edges_fill
Prototype |
procedure T6963C_rectangle_round_edges_fill(x0, y0, x1, y1, radius : integer; pcolor : byte); |
---|---|
Description |
Draws a filled rounded edge rectangle on Glcd. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
Example |
T6963C_rectangle_round_edges_fill(20, 20, 219, 107, 12, T6963C_WHITE); |
Notes |
None. |
T6963C_box
Prototype |
procedure T6963C_box(x0, y0, x1, y1 : integer; pcolor : byte); |
---|---|
Description |
Draws a box on the Glcd |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_box(0, 119, 239, 127, T6963C_WHITE); |
Notes |
None. |
T6963C_circle
Prototype |
procedure T6963C_circle(x, y : integer; r : longint; pcolor : word); |
---|---|
Description |
Draws a circle on the Glcd. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_circle(120, 64, 110, T6963C_WHITE); |
Notes |
None. |
T6963C_Circle_fill
Prototype |
procedure T6963C_Circle_fill(x, y : integer; r : longint; pcolor : word); |
---|---|
Description |
Draws a filled circle on the Glcd. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
Example |
T6963C_Circle_fill(120, 64, 110, T6963C_WHITE); |
Notes |
None. |
T6963C_image
Prototype |
procedure T6963C_image(const pic : ^byte); |
---|---|
Description |
Displays bitmap on Glcd. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_image(@my_image); |
Notes |
Image dimension must match the display dimension. Use the integrated Glcd Bitmap Editor (menu option Tools › Glcd Bitmap Editor) to convert image to a constant array suitable for displaying on Glcd. |
T6963C_Ext_Image
Prototype |
procedure T6963C_Ext_Image(image : dword); |
---|---|
Description |
Displays a bitmap from an external resource. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_Ext_image(153608); |
Notes |
Image dimension must match the display dimension. Use the integrated Glcd Bitmap Editor (menu option Tools › Glcd Bitmap Editor) to convert image to a constant array suitable for displaying on Glcd. |
T6963C_PartialImage
Prototype |
procedure T6963C_PartialImage(x_left, y_top, width, height, picture_width, picture_height : word; const image : ^byte); |
---|---|
Description |
Displays a partial area of the image on a desired location. |
Parameters |
|
Description |
Displays a partial area of the image on a desired location. |
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See T6963C_init routine. |
Example |
// Draws a 10x15 part of the image starting from the upper left corner on the coordinate (10,12). Original image size is 16x32. T6963C_PartialImage(10, 12, 10, 15, 16, 32, @image); |
Notes |
Image dimension must match the display dimension. Use the integrated Glcd Bitmap Editor (menu option Tools › Glcd Bitmap Editor) to convert image to a constant array suitable for displaying on Glcd. |
T6963C_Ext_PartialImage
Prototype |
procedure T6963C_Ext_PartialImage(x_left, y_top, width, height, picture_width, picture_height : word; image : dword); |
---|---|
Description |
Displays a partial area of the image (from an external resource) on a desired location. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See T6963C_init routine. |
Example |
T6963C_Ext_PartialImage(10, 12, 10, 15, 16, 32, 0); |
Notes |
Image dimension must match the display dimension. Use the integrated Glcd Bitmap Editor (menu option Tools › Glcd Bitmap Editor) to convert image to a constant array suitable for displaying on Glcd. |
T6963C_sprite
Prototype |
procedure T6963C_sprite(px, py : byte; const pic : ^byte; sx, sy : byte); |
---|---|
Description |
Fills graphic rectangle area (px, py) to (px+sx, py+sy) with custom size picture. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_sprite(76, 4, einstein, 88, 119); // draw a sprite |
Notes |
If |
T6963C_set_cursor
Prototype |
procedure T6963C_set_cursor(x, y : byte); |
---|---|
Description |
Sets cursor to row x and column y. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_set_cursor(cposx, cposy); |
Notes |
None. |
T6963C_displayGrPanel
Prototype |
procedure T6963C_displayGrPanel(n : word); |
---|---|
Description |
Display selected graphic panel. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// display graphic panel 1 T6963C_displayGrPanel(1); |
Notes |
None. |
T6963C_displayTxtPanel
Prototype |
procedure T6963C_displayTxtPanel(n : word); |
---|---|
Description |
Display selected text panel. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// display text panel 1 T6963C_displayTxtPanel(1); |
Notes |
None. |
T6963C_setGrPanel
Prototype |
procedure T6963C_setGrPanel(n : word); |
---|---|
Description |
Compute start address for selected graphic panel and set appropriate internal pointers. All subsequent graphic operations will be preformed at this graphic panel. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// set graphic panel 1 as current graphic panel. T6963C_setGrPanel(1); |
Notes |
None. |
T6963C_setTxtPanel
Prototype |
procedure T6963C_setTxtPanel(n : word); |
---|---|
Description |
Compute start address for selected text panel and set appropriate internal pointers. All subsequent text operations will be preformed at this text panel. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// set text panel 1 as current text panel. T6963C_setTxtPanel(1); |
Notes |
None. |
T6963C_panelFill
Prototype |
procedure T6963C_panelFill(v : word); |
---|---|
Description |
Fill current panel in full (graphic+text) with appropriate value (0 to clear). |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
clear current panel T6963C_panelFill(0); |
Notes |
None. |
T6963C_grFill
Prototype |
procedure T6963C_grFill(v: word); |
---|---|
Description |
Fill current graphic panel with appropriate value (0 to clear). |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// clear current graphic panel T6963C_grFill(0); |
Notes |
None. |
T6963C_txtFill
Prototype |
procedure T6963C_txtFill(v : word); |
---|---|
Description |
Fill current text panel with appropriate value (0 to clear). |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// clear current text panel T6963C_txtFill(0); |
Notes |
None. |
T6963C_cursor_height
Prototype |
procedure T6963C_cursor_height(n: word); |
---|---|
Description |
Set cursor size. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_cursor_height(7); |
Notes |
None. |
T6963C_graphics
Prototype |
procedure T6963C_graphics(n : word); |
---|---|
Description |
Enable/disable graphic displaying. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// enable graphic displaying T6963C_graphics(1); |
Notes |
None. |
T6963C_text
Prototype |
procedure T6963C_text(n : word); |
---|---|
Description |
Enable/disable text displaying. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// enable text displaying T6963C_text(1); |
Notes |
None. |
T6963C_cursor
Prototype |
procedure T6963C_cursor(n : word); |
---|---|
Description |
Set cursor on/off. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// set cursor on T6963C_cursor(1); |
Notes |
None. |
T6963C_cursor_blink
Prototype |
procedure T6963C_cursor_blink(n : word); |
---|---|
Description |
Enable/disable cursor blinking. |
Parameters |
|
Returns |
Nothing. |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// enable cursor blinking T6963C_cursor_blink(1); |
Notes |
None. |
Library Example
The following drawing demo tests advanced routines of the T6963C Glcd library.
Stellaris
program T6963C_240x128; uses __Lib_T6963C_Consts; // T6963C module connections var T6963C_dataPort : byte at GPIO_PORTE_DATA; // DATA port var T6963C_ctrlwr : sbit at GPIO_PORTD_DATA2_bit; // WR write signal var T6963C_ctrlrd : sbit at GPIO_PORTD_DATA1_bit; // RD read signal var T6963C_ctrlcd : sbit at GPIO_PORTD_DATA0_bit; // CD command/data signal var T6963C_ctrlrst : sbit at GPIO_PORTD_DATA4_bit; // RST reset signal var T6963C_ctrlwr_Direction : sbit at GPIO_PORTD_DIR2_bit; // WR write signal direction var T6963C_ctrlrd_Direction : sbit at GPIO_PORTD_DIR1_bit; // RD read signal direction var T6963C_ctrlcd_Direction : sbit at GPIO_PORTD_DIR0_bit; // CD command/data signal direction var T6963C_ctrlrst_Direction : sbit at GPIO_PORTD_DIR4_bit; // RST reset signal direction // Signals not used by library, they are set in main function var T6963C_ctrlce : sbit at GPIO_PORTD_DATA3_bit; // CE signal var T6963C_ctrlfs : sbit at GPIO_PORTD_DATA6_bit; // FS signal var T6963C_ctrlmd : sbit at GPIO_PORTD_DATA5_bit; // MD signal var T6963C_ctrlce_Direction : sbit at GPIO_PORTD_DIR3_bit; // CE signal direction var T6963C_ctrlfs_Direction : sbit at GPIO_PORTD_DIR6_bit; // FS signal direction var T6963C_ctrlmd_Direction : sbit at GPIO_PORTD_DIR5_bit; // MD signal direction // End T6963C module connections // Pin masks const CE_FS_MD_PINS = _GPIO_PINMASK_3 or _GPIO_PINMASK_6 or _GPIO_PINMASK_5; const INPUT_BUTTONS = _GPIO_PINMASK_0 or _GPIO_PINMASK_1 or _GPIO_PINMASK_2 or _GPIO_PINMASK_3 or _GPIO_PINMASK_4 or _GPIO_PINMASK_5 ; // End Pin masks var panel : byte; // current panel i : word; // general purpose register curs : byte; // cursor visibility cposx, cposy : word; // cursor x-y position txtcols : byte; // number of text coloms txt, txt1 : string[29]; txt2 : string[21]; begin {$DEFINE LINE_DEMO}// Uncomment to demonstrate line drawing routines {$DEFINE FILL_DEMO}// Uncomment to demonstrate fill routines {$DEFINE PARTIAL_IMAGE_DEMO}// Uncomment to demonstrate partial image routine txt1 := ' EINSTEIN WOULD HAVE LIKED mE'; txt := ' GLCD LIBRARY DEMO, WELCOME !'; txt2 := ' Partial image demo! '; // input buttons GPIO_Digital_Input(@GPIO_PORTA, INPUT_BUTTONS); // configure CE, FS and MD pins, others will be configured by the T6963C library GPIO_Digital_Output(@GPIO_PORTD, CE_FS_MD_PINS); T6963C_ctrlce := 0; // Enable T6963C T6963C_ctrlfs := 0; // Font Select 8x8 T6963C_ctrlmd := 0; // Column number select panel := 0; i := 0; curs := 0; cposx := 0; cposy := 0; // Initialize T6369C T6963C_init(240, 128, 8); {* * Enable both graphics and text display at the same time *} T6963C_graphics(1); T6963C_text(1); {* * Text messages *} T6963C_write_text(txt, 0, 0, T6963C_ROM_MODE_XOR); T6963C_write_text(txt1, 0, 15, T6963C_ROM_MODE_XOR); {* * Cursor *} T6963C_cursor_height(8); // 8 pixel height T6963C_set_cursor(0, 0); // Move cursor to top left T6963C_cursor(0); // Cursor off {* * Draw solid boxes *} T6963C_box(0, 0, 239, 8, T6963C_WHITE); T6963C_box(0, 119, 239, 127, T6963C_WHITE); {* * Draw rectangles *} {$IFDEF LINE_DEMO} T6963C_rectangle(0, 0, 239, 127, T6963C_WHITE); T6963C_rectangle(20, 20, 219, 107, T6963C_WHITE); T6963C_rectangle(40, 40, 199, 87, T6963C_WHITE); T6963C_rectangle(60, 60, 179, 67, T6963C_WHITE); {$ENDIF} {* * Draw rounded edge rectangle *} {$IFDEF LINE_DEMO} T6963C_Rectangle_Round_Edges(10, 10, 229, 117, 12, T6963C_WHITE); T6963C_Rectangle_Round_Edges(30, 30, 209, 97, 12, T6963C_WHITE); T6963C_Rectangle_Round_Edges(50, 50, 189, 77, 12, T6963C_WHITE); {$ENDIF} {* * Draw filled rounded edge rectangle *} {$IFDEF FILL_DEMO} T6963C_Rectangle_Round_Edges_Fill(10, 10, 229, 117, 12, T6963C_WHITE); T6963C_Rectangle_Round_Edges_Fill(20, 20, 219, 107, 12, T6963C_BLACK); T6963C_Rectangle_Round_Edges_Fill(30, 30, 209, 97, 12, T6963C_WHITE); T6963C_Rectangle_Round_Edges_Fill(40, 40, 199, 87, 12, T6963C_BLACK); T6963C_Rectangle_Round_Edges_Fill(50, 50, 189, 77, 12, T6963C_WHITE); {$ENDIF} {* * Draw a cross *} {$IFDEF LINE_DEMO} T6963C_line(0, 0, 239, 127, T6963C_WHITE); T6963C_line(0, 127, 239, 0, T6963C_WHITE); {$ENDIF} {* * Draw circles *} {$IFDEF LINE_DEMO} T6963C_circle(120, 64, 10, T6963C_WHITE); T6963C_circle(120, 64, 30, T6963C_WHITE); T6963C_circle(120, 64, 50, T6963C_WHITE); T6963C_circle(120, 64, 70, T6963C_WHITE); T6963C_circle(120, 64, 90, T6963C_WHITE); T6963C_circle(120, 64, 110, T6963C_WHITE); T6963C_circle(120, 64, 130, T6963C_WHITE); {$ENDIF} {* * Draw filled circles *} {$IFDEF FILL_DEMO} T6963C_circle_fill(120, 64, 60, T6963C_WHITE); T6963C_circle_fill(120, 64, 55, T6963C_BLACK); T6963C_circle_fill(120, 64, 50, T6963C_WHITE); T6963C_circle_fill(120, 64, 45, T6963C_BLACK); T6963C_circle_fill(120, 64, 40, T6963C_WHITE); T6963C_circle_fill(120, 64, 35, T6963C_BLACK); T6963C_circle_fill(120, 64, 30, T6963C_WHITE); T6963C_circle_fill(120, 64, 25, T6963C_BLACK); T6963C_circle_fill(120, 64, 20, T6963C_WHITE); T6963C_circle_fill(120, 64, 15, T6963C_BLACK); T6963C_circle_fill(120, 64, 10, T6963C_WHITE); T6963C_circle_fill(120, 64, 5, T6963C_BLACK); {$ENDIF} Delay_ms(1000); T6963C_sprite(76, 4, @einstein, 88, 119); // Draw a sprite Delay_ms(1000); T6963C_setGrPanel(1); // Select other graphic panel T6963C_image(@mikroE_240x128_bmp); T6963C_displayGrPanel(1); Delay_ms(1000); {$IFDEF PARTIAL_IMAGE_DEMO} T6963C_grFill(0); T6963C_PartialImage(0, 0, 64, 64, 240, 128, @mikroE_240x128_bmp); // Display partial image Delay_ms(1000); T6963C_graphics(0); {$ENDIF} T6963C_image(@mikroE_240x128_bmp); T6963C_graphics(1); T6963C_displayGrPanel(0); while (TRUE) do // Endless loop begin {* * If RA0 is pressed, toggle the display between graphic panel 0 and graphic 1 *} if (GPIO_PORTA_DATA0_bit) then begin Inc(panel) ; panel := panel and 1; T6963C_setPtr((T6963C_grMemSize + T6963C_txtMemSize) * panel, T6963C_GRAPHIC_HOME_ADDRESS_SET) ; Delay_ms(300) ; end {* * If RA1 is pressed, display only graphic panel *} else if (GPIO_PORTA_DATA1_bit) then begin T6963C_graphics(1) ; T6963C_text(0) ; Delay_ms(300) ; end {* * If RA2 is pressed, display only text panel *} else if (GPIO_PORTA_DATA2_bit) then begin T6963C_graphics(0); T6963C_text(1); Delay_ms(300); end {* * If RA3 is pressed, display text and graphic panels *} else if (GPIO_PORTA_DATA3_bit) then begin T6963C_graphics(1); T6963C_text(1); Delay_ms(300); end {* * If RA4 is pressed, change cursor *} else if (GPIO_PORTA_DATA4_bit) then begin Inc(curs); if (curs = 3) then curs := 0; case curs of 0: // no cursor T6963C_cursor(0); 1: begin // blinking cursor T6963C_cursor(1); T6963C_cursor_blink(1); end; 2: begin // non blinking cursor T6963C_cursor(1); T6963C_cursor_blink(0); end; end; Delay_ms(300); end {* * If RA5 is pressed, perform the "Partial image" demonstration *} else {$IFDEF PARTIAL_IMAGE_DEMO} if (GPIO_PORTA_DATA5_bit) then begin T6963C_setGrPanel(0); T6963C_setTxtPanel(0); T6963C_txtFill(0); T6963C_setGrPanel(1); T6963C_setTxtPanel(0); T6963C_graphics(1); T6963C_text(1); T6963C_displayGrPanel(1); T6963C_write_text(txt2, 5, 15, T6963C_ROM_MODE_XOR); Delay_1sec(); T6963C_grFill(0); T6963C_PartialImage(0, 0, 64, 64, 240, 128, @mikroE_240x128_bmp); Delay_ms(1500); T6963C_PartialImage(0, 0, 128, 128, 240, 128, @mikroE_240x128_bmp); Delay_ms(1500); T6963C_PartialImage(0, 0, 240, 128, 240, 128, @mikroE_240x128_bmp); Delay_ms(1500); T6963C_txtFill(0); T6963C_write_text(txt, 0, 0, T6963C_ROM_MODE_XOR); T6963C_write_text(txt1, 0, 15, T6963C_ROM_MODE_XOR); end; {$ENDIF} {* * Move cursor, even if not visible *} Inc(cposx); if (cposx = T6963C_txtCols) then begin cposx := 0; Inc(cposy); if (cposy = T6963C_grHeight div T6963C_CHARACTER_HEIGHT) then cposy := 0; end; T6963C_set_cursor(cposx, cposy); Delay_ms(100); end; end.
STM32
program T6963C_240x64; uses __Lib_T6963C_Consts; // T6963C module connections var T6963C_dataPort_Output : dword at GPIOD_ODR; // DATA port var T6963C_dataPort_Input : dword at GPIOD_IDR; // DATA port var T6963C_ctrlwr : sbit at GPIOD_ODR.B8; // WR write signal var T6963C_ctrlrd : sbit at GPIOD_ODR.B9; // RD read signal var T6963C_ctrlcd : sbit at GPIOD_ODR.B11; // CD command/data signal var T6963C_ctrlrst : sbit at GPIOD_ODR.B12; // RST reset signal // Signals not used by library, they are set in main function var T6963C_ctrlce : sbit at GPIOD_ODR.B10; // CE signal var T6963C_ctrlfs : sbit at GPIOD_ODR.B13; // FS signal // End T6963C module connections // Pin masks const CE_FS_PINS = _GPIO_PINMASK_10 or _GPIO_PINMASK_13; const INPUT_BUTTONS = _GPIO_PINMASK_8 or _GPIO_PINMASK_9 or _GPIO_PINMASK_10 or _GPIO_PINMASK_11 or _GPIO_PINMASK_12 or _GPIO_PINMASK_13 ; // End Pin masks var panel : byte; // current panel i : word; // general purpose register curs : byte; // cursor visibility cposx, cposy : word; // cursor x-y position txt, txt1 : string[29]; txt2 : string[21]; begin {$DEFINE LINE_DEMO}// Uncomment to demonstrate line drawing routines {$DEFINE FILL_DEMO}// Uncomment to demonstrate fill routines {$DEFINE PARTIAL_IMAGE_DEMO}// Uncomment to demonstrate partial image routine txt1 := ' EINSTEIN WOULD HAVE LIKED mE'; txt := ' GLCD LIBRARY DEMO, WELCOME !'; txt2 := ' Partial image demo!'; // input buttons GPIO_Digital_Input(@GPIOE_BASE, INPUT_BUTTONS); // configure CE and FS pins, others will be configured by the T6963C library GPIO_Digital_Output(@GPIOD_BASE, CE_FS_PINS); T6963C_ctrlce := 0; // Enable T6963C T6963C_ctrlfs := 0; // Font Select 8x8 panel := 0; i := 0; curs := 0; cposx := 0; cposy := 0; // Initialize T6369C T6963C_init(240, 64, 8); {* * Enable both graphics and text display at the same time *} T6963C_graphics(1); T6963C_text(1); {* * Text messages *} T6963C_write_text(txt, 0, 0, T6963C_ROM_MODE_XOR); T6963C_write_text(txt1, 0, 7, T6963C_ROM_MODE_XOR); {* * Cursor *} T6963C_cursor_height(8); // 8 pixel height T6963C_set_cursor(0, 0); // Move cursor to top left T6963C_cursor(0); // Cursor off {* * Draw solid boxes *} T6963C_box(0, 0, 239, 8, T6963C_WHITE); T6963C_box(0, 55, 239, 63, T6963C_WHITE); {* * Draw rectangles *} {$IFDEF LINE_DEMO} T6963C_rectangle(0, 0, 239, 63, T6963C_WHITE); T6963C_rectangle(20, 11, 219, 53, T6963C_WHITE); T6963C_rectangle(40, 21, 199, 43, T6963C_WHITE); T6963C_rectangle(60, 30, 179, 34, T6963C_WHITE); {$ENDIF} {* * Draw rounded edge rectangle *} {$IFDEF LINE_DEMO} T6963C_Rectangle_Round_Edges(30,16, 209, 48, 12, T6963C_WHITE); T6963C_Rectangle_Round_Edges(50,25, 189, 39, 5, T6963C_WHITE); {$ENDIF} {* * Draw filled rounded edge rectangle *} {$IFDEF FILL_DEMO} T6963C_Rectangle_Round_Edges_Fill(10, 10, 229, 53, 12, T6963C_WHITE); T6963C_Rectangle_Round_Edges_Fill(15, 15, 224, 49, 12, T6963C_BLACK); T6963C_Rectangle_Round_Edges_Fill(20, 20, 219, 44, 9, T6963C_WHITE); T6963C_Rectangle_Round_Edges_Fill(25, 25, 214, 39, 7, T6963C_BLACK); T6963C_Rectangle_Round_Edges_Fill(30, 30, 209, 34, 2, T6963C_WHITE); {$ENDIF} {* * Draw a cross *} {$IFDEF LINE_DEMO} T6963C_line(0, 0, 239, 63, T6963C_WHITE); T6963C_line(0, 63, 239, 0, T6963C_WHITE); {$ENDIF} {* * Draw circles *} {$IFDEF LINE_DEMO} T6963C_circle(120, 32, 10, T6963C_WHITE); T6963C_circle(120, 32, 30, T6963C_WHITE); T6963C_circle(120, 32, 50, T6963C_WHITE); T6963C_circle(120, 32, 70, T6963C_WHITE); T6963C_circle(120, 32, 90, T6963C_WHITE); T6963C_circle(120, 32, 110, T6963C_WHITE); T6963C_circle(120, 32, 130, T6963C_WHITE); {$ENDIF} {* * Draw filled circles *} {$IFDEF FILL_DEMO} T6963C_circle_fill(120, 32, 40, T6963C_WHITE); T6963C_circle_fill(120, 32, 35, T6963C_BLACK); T6963C_circle_fill(120, 32, 30, T6963C_WHITE); T6963C_circle_fill(120, 32, 25, T6963C_BLACK); T6963C_circle_fill(120, 32, 20, T6963C_WHITE); T6963C_circle_fill(120, 32, 15, T6963C_BLACK); T6963C_circle_fill(120, 32, 10, T6963C_WHITE); T6963C_circle_fill(120, 32, 5, T6963C_BLACK); {$ENDIF} Delay_ms(1000); T6963C_sprite(60, 0, @einstein, 120, 64); // Draw a sprite Delay_ms(1000); T6963C_setGrPanel(1); // Select other graphic panel T6963C_image(@mikroE_240x64_bmp); T6963C_displayGrPanel(1); Delay_ms(1000); {$IFDEF PARTIAL_IMAGE_DEMO} T6963C_grFill(0); T6963C_PartialImage(0, 0, 64, 64, 240, 64, @mikroE_240x64_bmp); // Display partial image Delay_ms(1000); T6963C_graphics(0); {$ENDIF} T6963C_image(@mikroE_240x64_bmp); T6963C_graphics(1); T6963C_displayGrPanel(0); while (TRUE) do // Endless loop begin {* * If RE8 is pressed, toggle the display between graphic panel 0 and graphic 1 *} if(GPIOE_IDR.B8) then begin Inc(panel) ; panel := panel and 1 ; T6963C_displayGrPanel(panel) ; Delay_ms(300); end {* * If RE9 is pressed, display only graphic panel *} else if (GPIOE_IDR.B9) then begin T6963C_graphics(1) ; T6963C_text(0) ; Delay_ms(300); end {* * If RE10 is pressed, display only text panel *} else if(GPIOE_IDR.B10) then begin T6963C_graphics(0); T6963C_text(1); Delay_ms(300); end {* * If RE11 is pressed, display text and graphic panels *} else if(GPIOE_IDR.B11) then begin T6963C_graphics(1); T6963C_text(1); Delay_ms(300); end {* * If RE12 is pressed, change cursor *} else if(GPIOE_IDR.B12) then begin Inc(curs); if (curs = 3) then curs := 0; case curs of 0: // no cursor T6963C_cursor(0); 1: begin // blinking cursor T6963C_cursor(1); T6963C_cursor_blink(1); end; 2: begin // non blinking cursor T6963C_cursor(1); T6963C_cursor_blink(0); end; end; Delay_ms(300); end {* * If RE13 is pressed, perform the "Partial image" demonstration *} else {$IFDEF PARTIAL_IMAGE_DEMO} if(GPIOE_IDR.B13) then begin T6963C_setGrPanel(0); T6963C_setTxtPanel(0); T6963C_txtFill(0); T6963C_setGrPanel(1); T6963C_setTxtPanel(0); T6963C_graphics(1); T6963C_text(1); T6963C_displayGrPanel(1); T6963C_write_text(txt2, 5, 7, T6963C_ROM_MODE_XOR); Delay_1sec(); for i := 0 to 3 do begin T6963C_grFill(0); T6963C_PartialImage(i*80 + 10, 0, 64, 64, 240, 64, @mikroE_240x64_bmp); // Partial image Delay_ms(500); end; T6963C_txtFill(0); T6963C_write_text(txt, 0, 0, T6963C_ROM_MODE_XOR); T6963C_write_text(txt1, 0, 7, T6963C_ROM_MODE_XOR); end; {$ENDIF} {* * Move cursor, even if not visible *} Inc(cposx); if (cposx = T6963C_txtCols) then begin cposx := 0; Inc(cposy); if (cposy = T6963C_grHeight / T6963C_CHARACTER_HEIGHT) then cposy := 0; end; T6963C_set_cursor(cposx, cposy); Delay_ms(100); end; end.
What do you think about this topic ? Send us feedback!