T6963C Graphic Lcd Library
The mikroPascal PRO for PIC 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.
Important :
- 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.
- PIC16 family of MCUs does not support working with external resources.
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
| The following variables must be defined in all projects using T6963C Graphic Lcd library: | Description : | Example : |
|---|---|---|
var T6963C_dataPort : byte; sfr; external; |
T6963C Data Port. | var T6963C_dataPort : byte at PORTD; |
var T6963C_ctrlwr : sbit; sfr; external; |
Write signal. | var T6963C_ctrlwr : sbit at RC2_bit; |
var T6963C_ctrlrd : sbit; sfr; external; |
Read signal. | var T6963C_ctrlrd : sbit at RC1_bit; |
var T6963C_ctrlcd : sbit; sfr; external; |
Command/Data signal. | var T6963C_ctrlcd : sbit at RC0_bit; |
var T6963C_ctrlrst : sbit; sfr; external; |
Reset signal. | var T6963C_ctrlrst : sbit at RC4_bit; |
var T6963C_ctrlwr_Direction : sbit; sfr; external; |
Direction of the Write pin. | var T6963C_ctrlwr_Direction : sbit at TRISC2_bit; |
var T6963C_ctrlrd_Direction : sbit; sfr; external; |
Direction of the Read pin. | var T6963C_ctrlrd_Direction : sbit at TRISC1_bit; |
var T6963C_ctrlcd_Direction : sbit; sfr; external; |
Direction of the Command/Data pin. | var T6963C_ctrlcd_Direction : sbit at TRISC0_bit; |
var T6963C_ctrlrst_Direction : sbit; sfr; external; |
Direction of the Reset pin. | var T6963C_ctrlrst_Direction : sbit at TRISC4_bit; |
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_Write_Const_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 : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Initializes T6963C Graphic Lcd controller. Parameters :
Display RAM organization:
schematic:
+---------------------+ /\
+ GRAPHICS PANEL #0 + |
+ + |
+ + |
+ + |
+---------------------+ | PANEL 0
+ TEXT PANEL #0 + |
+ + \/
+---------------------+ /\
+ GRAPHICS PANEL #1 + |
+ + |
+ + |
+ + |
+---------------------+ | PANEL 1
+ TEXT PANEL #1 + |
+ + |
+---------------------+ \/
|
| Requires |
Global variables :
|
| Example |
// T6963C module connections var T6963C_dataPort : byte at PORTD; var T6963C_ctrlwr : sbit at RC2_bit; var T6963C_ctrlrd : sbit at RC1_bit; var T6963C_ctrlcd : sbit at RC0_bit; var T6963C_ctrlrst : sbit at RC4_bit; var T6963C_ctrlwr_Direction : sbit at TRISC2_bit; var T6963C_ctrlrd_Direction : sbit at TRISC1_bit; var T6963C_ctrlcd_Direction : sbit at TRISC0_bit; var T6963C_ctrlrst_Direction : sbit at TRISC4_bit; // End of T6963C module connections ... // init display for 240 pixel width, 128 pixel height and 8 bits character width T6963C_Init(240, 128, 8); |
T6963C_WriteData
| Prototype |
procedure T6963C_WriteData(mydata : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Writes data to T6963C controller. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_WriteData(AddrL); |
T6963C_WriteCommand
| Prototype |
procedure T6963C_WriteCommand(mydata : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Writes command to T6963C controller. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_WriteCommand(T6963C_CURSOR_POINTER_SET); |
T6963C_SetPtr
| Prototype |
procedure T6963C_SetPtr(p : word; c : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Sets the memory pointer p for command c. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_SetPtr(T6963C_grHomeAddr + start, T6963C_ADDRESS_POINTER_SET); |
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(); |
|---|---|
| Returns |
Nothing. |
| Description |
Pools the status byte, and loops until Toshiba Glcd module is ready. |
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_WaitReady(); |
T6963C_Fill
| Prototype |
procedure T6963C_Fill(v : byte; start, len : word); |
|---|---|
| Returns |
Nothing. |
| Description |
Fills controller memory block with given byte. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_Fill(0x33,0x00FF,0x000F); |
T6963C_Dot
| Prototype |
procedure T6963C_Dot(x, y : integer; color : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Draws a dot in the current graphic panel of Glcd at coordinates (x, y). Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_Dot(x0, y0, T6963C_WHITE); |
T6963C_Set_Font_Adv
| Prototype |
procedure T6963C_Set_Font_Adv(activeFont : ^const far 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, 1, 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, 5, 7, 32); |
| Notes |
None. |
T6963C_Write_Char
| Prototype |
procedure T6963C_Write_Char(c, x, y, mode : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Writes a char in the current text panel of Glcd at coordinates (x, y). Parameters :
Mode parameter explanation:
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_Write_Char('A',22,23,T6963C_ROM_MODE_AND);
|
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); |
|---|---|
| Returns |
Nothing. |
| Description |
Writes text in the current text panel of Glcd at coordinates (x, y). Parameters :
Mode parameter explanation:
|
| 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);
|
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_Write_Const_Text_Adv
| Prototype |
procedure T6963C_Write_Const_Text_Adv(text : ^const far byte ; x, y : word); |
|---|---|
| Description |
Writes text located in the program memory on the glcd at coordinates (x, y). |
| Parameters |
|
| Returns |
Nothing. |
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
| Example |
const ctext = 'mikroElektronika'; ... SPI_T6963C_Write_Const_Text_Adv(@ctext, 0, 0); |
| Notes |
None. |
T6963C_Line
| Prototype |
procedure T6963C_Line(x0, y0, x1, y1 : integer; pcolor : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Draws a line from (x0, y0) to (x1, y1). Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_Line(0, 0, 239, 127, T6963C_WHITE); |
T6963C_Rectangle
| Prototype |
procedure T6963C_Rectangle(x0, y0, x1, y1 : integer; pcolor : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Draws a rectangle on Glcd. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_Rectangle(20, 20, 219, 107, T6963C_WHITE); |
T6963C_rectangle_round_edges
| Prototype |
procedure T6963C_rectangle_round_edges(x0, y0, x1, y1, radius : integer; pcolor : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Draws a rounded edge rectangle on Glcd. Parameters :
|
| 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); |
T6963C_rectangle_round_edges_fill
| Prototype |
procedure T6963C_rectangle_round_edges_fill(x0, y0, x1, y1, radius : integer; pcolor : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Draws a filled rounded edge rectangle on Glcd. Parameters :
|
| 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); |
T6963C_Box
| Prototype |
procedure T6963C_Box(x0, y0, x1, y1 : integer; pcolor : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Draws a box on Glcd Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_Box(0, 119, 239, 127, T6963C_WHITE); |
T6963C_Circle
| Prototype |
procedure T6963C_Circle(x, y : integer; r : longint; pcolor : word); |
|---|---|
| Returns |
Nothing. |
| Description |
Draws a circle on Glcd. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_Circle(120, 64, 110, T6963C_WHITE); |
T6963C_Circle_fill
| Prototype |
procedure T6963C_Circle_fill(x, y : integer; r : longint; pcolor : word); |
|---|---|
| Returns |
Nothing. |
| Description |
Draws a filled circle on Glcd. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_Circle_fill(120, 64, 110, T6963C_WHITE); |
T6963C_Image
| Prototype |
procedure T6963C_Image(const pic : ^byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Displays bitmap on Glcd. Parameters :
Use the integrated Glcd Bitmap Editor (menu option Tools › Glcd Bitmap Editor) to convert image to a constant array suitable for displaying on Glcd. Note :
Image dimension must match the display dimension.
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_Image(@mc); |
T6963C_Ext_Image
| Prototype |
procedure T6963C_Ext_Image(pic : 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); |
|---|---|
| Returns |
Nothing. |
| Description |
Displays a partial area of the image on a desired location. Parameters :
Use the integrated Glcd Bitmap Editor (menu option Tools › Glcd Bitmap Editor) to convert image to a constant array suitable for displaying on Glcd. Note :
Image dimension must match the display dimension.
|
| Requires |
Toshiba Glcd module needs to be initialized. See the 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); |
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 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); |
|---|---|
| Returns |
Nothing. |
| Description |
Fills graphic rectangle area (px, py) to (px+sx, py+sy) with custom size picture. Parameters :
Note :
If px and sx parameters are not multiples of the font width they will be scaled to the nearest lower number that is a multiple of the font width.
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_Sprite(76, 4, einstein, 88, 119); // draw a sprite |
T6963C_Set_Cursor
| Prototype |
procedure T6963C_Set_Cursor(x, y : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Sets cursor to row x and column y. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_Set_Cursor(cposx, cposy); |
T6963C_DisplayGrPanel
| Prototype |
procedure T6963C_DisplayGrPanel(n : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Display selected graphic panel. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
// display graphic panel 1 T6963C_DisplayGrPanel(1); |
T6963C_DisplayTxtPanel
| Prototype |
procedure T6963C_DisplayTxtPanel(n : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Display selected text panel. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
// display text panel 1 T6963C_DisplayTxtPanel(1); |
T6963C_SetGrPanel
| Prototype |
procedure T6963C_SetGrPanel(n : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Computes start address for selected graphic panel and set appropriate internal pointers. All subsequent graphic operations will be preformed at this graphic panel. Parameters :
|
| 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); |
T6963C_SetTxtPanel
| Prototype |
procedure T6963C_SetTxtPanel(n : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Computes start address for selected text panel and set appropriate internal pointers. All subsequent text operations will be preformed at this text panel. Parameters :
|
| 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); |
T6963C_PanelFill
| Prototype |
procedure T6963C_PanelFill(v : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Fill current panel in full (graphic+text) with appropriate value (0 to clear). Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
// clear current panel T6963C_PanelFill(0); |
T6963C_GrFill
| Prototype |
procedure T6963C_GrFill(v : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Fill current graphic panel with appropriate value (0 to clear). Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
// clear current graphic panel T6963C_GrFill(0); |
T6963C_TxtFill
| Prototype |
procedure T6963C_TxtFill(v : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Fill current text panel with appropriate value (0 to clear). Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
// clear current text panel T6963C_TxtFill(0); |
T6963C_Cursor_Height
| Prototype |
procedure T6963C_Cursor_Height(n : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Set cursor size. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
T6963C_Cursor_Height(7); |
T6963C_Graphics
| Prototype |
procedure T6963C_Graphics(n : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Enable/disable graphic displaying. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
// enable graphic displaying T6963C_Graphics(1); |
T6963C_Text
| Prototype |
procedure T6963C_Text(n : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Enable/disable text displaying. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
// enable text displaying T6963C_Text(1); |
T6963C_cursor
| Prototype |
procedure T6963C_Cursor(n : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Set cursor on/off. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
// set cursor on T6963C_Cursor(1); |
T6963C_Cursor_Blink
| Prototype |
procedure T6963C_Cursor_Blink(n : byte); |
|---|---|
| Returns |
Nothing. |
| Description |
Enable/disable cursor blinking. Parameters :
|
| Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_Init routine. |
| Example |
// enable cursor blinking T6963C_cursor_blink(1); |
Library Example
The following drawing demo tests advanced routines of the T6963C Glcd library. Hardware configurations in this example are made for the T6963C 240x128 display, EasyPIC6 board and PIC16F887.
program T6963C_240x128;
uses __Lib_T6963C_Consts;
// T6963C module connections
var T6963C_dataPort : byte at PORTD; // DATA port
var T6963C_ctrlwr : sbit at RC2_bit; // WR write signal
var T6963C_ctrlrd : sbit at RC1_bit; // RD read signal
var T6963C_ctrlcd : sbit at RC0_bit; // CD command/data signal
var T6963C_ctrlrst : sbit at RC4_bit; // RST reset signal
var T6963C_ctrlwr_Direction : sbit at TRISC2_bit; // WR write signal direction
var T6963C_ctrlrd_Direction : sbit at TRISC1_bit; // RD read signal direction
var T6963C_ctrlcd_Direction : sbit at TRISC0_bit; // CD command/data signal direction
var T6963C_ctrlrst_Direction : sbit at TRISC4_bit; // RST reset signal direction
// Signals not used by library, they are set in main function
var T6963C_ctrlce : sbit at RC3_bit; // CE signal
var T6963C_ctrlfs : sbit at RC6_bit; // FS signal
var T6963C_ctrlmd : sbit at RC5_bit; // MD signal
var T6963C_ctrlce_Direction : sbit at TRISC3_bit; // CE signal direction
var T6963C_ctrlfs_Direction : sbit at TRISC6_bit; // FS signal direction
var T6963C_ctrlmd_Direction : sbit at TRISC5_bit; // MD signal direction
// End T6963C module connections
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];
begin
txt1 := ' EINSTEIN WOULD HAVE LIKED mE';
txt := ' GLCD LIBRARY DEMO, WELCOME !';
ANSEL := 0; // Configure AN pins as digital I/O
ANSELH := 0;
C1ON_bit := 0; // Disable comparators
C2ON_bit := 0;
TRISB0_bit := 1; // Set RB0 as input
TRISB1_bit := 1; // Set RB1 as input
TRISB2_bit := 1; // Set RB2 as input
TRISB3_bit := 1; // Set RB3 as input
TRISB4_bit := 1; // Set RB4 as input
T6963C_ctrlce_Direction := 0;
T6963C_ctrlce := 0; // Enable T6963C
T6963C_ctrlfs_Direction := 0;
T6963C_ctrlfs := 0; // Font Select 8x8
T6963C_ctrlmd_Direction := 0;
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 rectangles
*}
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);
{*
* Draw a cross
*}
T6963C_line(0, 0, 239, 127, T6963C_WHITE);
T6963C_line(0, 127, 239, 0, T6963C_WHITE);
{*
* Draw solid boxes
*}
T6963C_box(0, 0, 239, 8, T6963C_WHITE);
T6963C_box(0, 119, 239, 127, T6963C_WHITE);
//while true do nop;
{*
* Draw circles
*}
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);
T6963C_sprite(76, 4, @einstein, 88, 119); // Draw a sprite
T6963C_setGrPanel(1); // Select other graphic panel
T6963C_sprite(0, 0, @mikroE_240x64_bmp, 240, 64); // 240x128 can't be stored in most of PIC16 MCUs
T6963C_sprite(0, 64, @mikroE_240x64_bmp, 240, 64); // it is replaced with smaller picture 240x64
// Smaller picture is drawn two times
while (TRUE) do // Endless loop
begin
{*
* If PORTA_0 is pressed, toggle the display between graphic panel 0 and graphic 1
*}
if( RB0_bit <> 0) then
begin
T6963C_graphics(1);
T6963C_text(0);
Delay_ms(300);
end
{*
* If PORTA_1 is pressed, display only graphic panel
*}
else
if ( RB1_bit <> 0) 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 PORTA_2 is pressed, display only text panel
*}
else
if ( RB2_bit <> 0) then
begin
T6963C_graphics(0) ;
T6963C_text(1) ;
Delay_ms(300) ;
end
{*
* If PORTA_3 is pressed, display text and graphic panels
*}
else
if ( RB3_bit <> 0) then
begin
T6963C_graphics(1) ;
T6963C_text(1) ;
Delay_ms(300) ;
end
{*
* If PORTA_4 is pressed, change cursor
*}
else
if( RB4_bit <> 0) 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;
{*
* 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.
HW Connection

T6963C Glcd HW connection
What do you think about this topic ? Send us feedback!




