T6963C Graphic Lcd Library

The mikroC PRO for PIC32 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.

  Important :

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

T6963C 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 :
extern sfr atomic unsigned long T6963C_dataPort; T6963C Data Port. char T6963C_dataPort at PORTB;
extern sfr atomic sbit T6963C_ctrlwr; Write signal. sbit T6963C_ctrlwr at LATF2_bit;
extern sfr atomic sbit T6963C_ctrlrd; Read signal. sbit T6963C_ctrlrd at LATF1_bit;
extern sfr atomic sbit T6963C_ctrlcd; Command/Data signal. sbit T6963C_ctrlcd at LATF0_bit;
extern sfr atomic sbit T6963C_ctrlrst; Reset signal. sbit T6963C_ctrlrst at LATF4_bit;
extern sfr atomic sbit T6963C_ctrlwr_Direction; Direction of the Write pin. sbit T6963C_ctrlwr_Direction at TRISF2_bit;
extern sfr atomic sbit T6963C_ctrlrd_Direction; Direction of the Read pin. sbit T6963C_ctrlrd_Direction at TRISF1_bit;
extern sfr atomic sbit T6963C_ctrlcd_Direction; Direction of the Command/Data pin. sbit T6963C_ctrlcd_Direction at TRISF0_bit;
extern sfr atomic sbit T6963C_ctrlrst_Direction; Direction of the Reset pin. sbit T6963C_ctrlrst_Direction at TRISF4_bit;

Library Routines

The following low level library routines are implemented as macros. These macros can be found in the __T6963C.h header file which is located in the T6963C example projects folders.

T6963C_init

Prototype

void T6963C_init(unsigned int width, unsigned char height, unsigned char fntW);

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
  • width: width of the Glcd panel
  • height: height of the Glcd panel
  • fntW: font width
Returns

Nothing.

Requires

Global variables :

  • T6963C_dataPort: Data Port
  • T6963C_ctrlwr: Write signal pin
  • T6963C_ctrlrd: Read signal pin
  • T6963C_ctrlcd: Command/Data signal pin
  • T6963C_ctrlrst: Reset signal pin

  • T6963C_ctrlwr_Direction: Direction of Write signal pin
  • T6963C_ctrlrd_Direction: Direction of Read signal pin
  • T6963C_ctrlcd_Direction: Direction of Command/Data signal pin
  • T6963C_ctrlrst_Direction: Direction of Reset signal pin
must be defined before using this function.

Example
// T6963C module connections
char T6963C_dataPort at PORTB;                   // DATA port

sbit T6963C_ctrlwr  at LATF2_bit;                // WR write signal
sbit T6963C_ctrlrd  at LATF1_bit;                // RD read signal
sbit T6963C_ctrlcd  at LATF0_bit;                // CD command/data signal
sbit T6963C_ctrlrst at LATF4_bit;                // RST reset signal
sbit T6963C_ctrlwr_Direction  at TRISF2_bit;     // WR write signal
sbit T6963C_ctrlrd_Direction  at TRISF1_bit;     // RD read signal
sbit T6963C_ctrlcd_Direction  at TRISF0_bit;     // CD command/data signal
sbit T6963C_ctrlrst_Direction at TRISF4_bit;     // RST reset signal

// Signals not used by library, they are set in main function
sbit T6963C_ctrlce at LATF3_bit;                 // CE signal
sbit T6963C_ctrlfs at LATF6_bit;                 // FS signal
sbit T6963C_ctrlmd at LATF5_bit;                 // MD signal
sbit T6963C_ctrlce_Direction  at TRISF3_bit;     // CE signal direction
sbit T6963C_ctrlfs_Direction  at TRISF6_bit;     // FS signal direction
sbit T6963C_ctrlmd_Direction  at TRISF5_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);
Notes

None.

T6963C_writeData

Prototype

void T6963C_writeData(unsigned char mydata);

Description

Writes data to T6963C controller.

Parameters
  • mydata: data to be written
Returns

Nothing.

Requires

Toshiba Glcd module needs to be initialized. See the T6963C_init routine.

Example
T6963C_writeData(AddrL);
Notes

None.

T6963C_writeCommand

Prototype

void T6963C_writeCommand(unsigned char mydata);

Description

Writes command to T6963C controller.

Parameters
  • mydata: command to be written
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

void T6963C_setPtr(unsigned int p, unsigned char c);

Description

Sets the memory pointer p for command p.

Parameters
  • p: address where command should be written
  • c: command to be written
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

void T6963C_Set_Ext_Buffer(char* (*getExtDataPtr)(unsigned long offset, unsigned long count, unsigned long* num));

Returns

Nothing.

Description

Function sets pointer to the user function which manipulates the external resource.

Parameters :

  • offset - offset from the beginning of the resource from where the data is requested.
  • count - requested number of bytes.
  • num - variable for holding the returned number ob byte (less or equal to the number of acqired bytes).

Requires

Glcd module needs to be initialized. See the T6963C_Init routine.

Example
char* ReadExternalBuffer(unsigned long offset, unsigned int count, unsigned int *num){
  unsigned long start_sector;
  unsigned int pos;

  start_sector = Mmc_Get_File_Write_Sector() + offset/512;
  pos = (unsigned long)offset%512;

  if(start_sector == currentSector+1){
    Mmc_Multi_Read_Buffer(EXT_BUFFER);
    currentSector = start_sector;
  }else
    if(start_sector != currentSector){
      Mmc_Multi_Read_Stop();
      Mmc_Multi_Read_Start(start_sector);
      Mmc_Multi_Read_Buffer(EXT_BUFFER);
      currentSector = start_sector;
    }

  if(count>512-pos){
    *num = 512-pos;
  }
  else
    *num = count;

  return EXT_BUFFER+pos;
}

T6963C_Set_Ext_Buffer(ReadExternalBuffer);

T6963C_waitReady

Prototype

void 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

void T6963C_fill(unsigned char v, unsigned int start, unsigned int len);

Description

Fills controller memory block with given byte.

Parameters
  • v: byte to be written
  • start: starting address of the memory block
  • len: length of the memory block in bytes
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

void T6963C_dot(int x, int y, unsigned char color);

Description

Draws a dot in the current graphic panel of Glcd at coordinates (x, y).

Parameters
  • x: dot position on x-axis
  • y: dot position on y-axis
  • color: color parameter. Valid values: T6963C_BLACK, T6963C_WHITE and T6963C_INVERT.
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

void T6963C_Set_Font_Adv(const char *activeFont, unsigned char font_color, char font_orientation);

Description

Sets font that will be used with T6963C_Write_Char_Adv and T6963C_Write_Text_Adv routines.

Parameters
  • activeFont: font to be set. Needs to be formatted as an array of char.
  • font_color: sets font color.
  • font_orientation: sets font orientation.
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

void T6963C_Set_Ext_Font_Adv(unsigned long activeFont, unsigned int font_color, char font_orientation);

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
  • activeFont: font to be set. This parameter represents the address in the exteral resource from where the font data begins.
  • font_color: sets font color.
  • font_orientation: sets font orientation.
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

void T6963C_write_char(unsigned char c, unsigned char x, unsigned char y, unsigned char mode);

Description

Writes a char in the current text panel of Glcd at coordinates (x, y).

Parameters
  • c: char to be written
  • x: char position on x-axis
  • y: char position on y-axis
  • mode: mode parameter. Valid values: T6963C_ROM_MODE_OR, T6963C_ROM_MODE_XOR, T6963C_ROM_MODE_AND and T6963C_ROM_MODE_TEXT

Mode parameter explanation:

  • OR Mode: In the OR-Mode, text and graphics can be displayed and the data is logically "OR-ed". This is the most common way of combining text and graphics for example labels on buttons.
  • XOR-Mode: In this mode, the text and graphics data are combined via the logical "exclusive OR". This can be useful to display text in the negative mode, i.e. white text on black background.
  • AND-Mode: The text and graphic data shown on display are combined via the logical "AND function".
  • TEXT-Mode: This option is only available when displaying just a text. The Text Attribute values are stored in the graphic area of display memory.
For more details see the T6963C datasheet.

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

void T6963C_write_char_adv(unsigned char c, unsigned int x, unsigned int y);

Description

Writes a char in the current text panel of Glcd at coordinates (x, y).

Parameters
  • c: char to be written
  • x: char position on x-axis
  • y: char position on y-axis
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

void T6963C_write_text(unsigned char *str, unsigned int x, unsigned int y, unsigned char mode);

Description

Writes text in the current text panel of Glcd at coordinates (x, y).

Parameters
  • str: text to be written
  • x: text position on x-axis
  • y: text position on y-axis
  • mode: mode parameter. Valid values: T6963C_ROM_MODE_OR, T6963C_ROM_MODE_XOR, T6963C_ROM_MODE_AND and T6963C_ROM_MODE_TEXT

Mode parameter explanation:

  • OR Mode: In the OR-Mode, text and graphics can be displayed and the data is logically "OR-ed". This is the most common way of combining text and graphics for example labels on buttons.
  • XOR-Mode: In this mode, the text and graphics data are combined via the logical "exclusive OR". This can be useful to display text in the negative mode, i.e. white text on black background.
  • AND-Mode: The text and graphic data shown on display are combined via the logical "AND function".
  • TEXT-Mode: This option is only available when displaying just a text. The Text Attribute values are stored in the graphic area of display memory.
For more details see the T6963C datasheet.

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

void T6963C_Write_Text_Adv(unsigned char *text, unsigned int x, unsigned int y);

Description

Writes text in the current text panel of Glcd at coordinates (x, y).

Parameters
  • str: text to be written
  • x: text position on x-axis
  • y: text position on y-axis
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

void T6963C_line(int x0, int y0, int x1, int y1, unsigned char pcolor);

Description

Draws a line from (x0, y0) to (x1, y1).

Parameters
  • x0: x coordinate of the line start
  • y0: y coordinate of the line end
  • x1: x coordinate of the line start
  • y1: y coordinate of the line end
  • pcolor: color parameter. Valid values: T6963C_BLACK, T6963C_WHITE and T6963C_INVERT.
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

void T6963C_rectangle(int x0, int y0, int x1, int y1, unsigned char pcolor);

Description

Draws a rectangle on Glcd.

Parameters
  • x0: x coordinate of the upper left rectangle corner
  • y0: y coordinate of the upper left rectangle corner
  • x1: x coordinate of the lower right rectangle corner
  • y1: y coordinate of the lower right rectangle corner
  • pcolor: color parameter. Valid values: T6963C_BLACK, T6963C_WHITE and T6963C_INVERT.
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

void T6963C_rectangle_round_edges(int x0, int y0, int x1, int y1, int round_radius, unsigned char pcolor);

Description

Draws a rounded edge rectangle on Glcd.

Parameters
  • x0: x coordinate of the upper left rectangle corner
  • y0: y coordinate of the upper left rectangle corner
  • x1: x coordinate of the lower right rectangle corner
  • y1: y coordinate of the lower right rectangle corner
  • round_radius: radius of the rounded edge.
  • pcolor: color parameter. Valid values: T6963C_BLACK, T6963C_WHITE and T6963C_INVERT.
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

void T6963C_rectangle_round_edges_fill(int x0, int y0, int x1, int y1, int round_radius, unsigned char pcolor);

Description

Draws a filled rounded edge rectangle on Glcd.

Parameters
  • x0: x coordinate of the upper left rectangle corner
  • y0: y coordinate of the upper left rectangle corner
  • x1: x coordinate of the lower right rectangle corner
  • y1: y coordinate of the lower right rectangle corner
  • round_radius: radius of the rounded edge
  • pcolor: color parameter. Valid values: T6963C_BLACK, T6963C_WHITE and T6963C_INVERT.
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

void T6963C_box(int x0, int y0, int x1, int y1, unsigned char pcolor);

Description

Draws a box on the Glcd

Parameters
  • x0: x coordinate of the upper left box corner
  • y0: y coordinate of the upper left box corner
  • x1: x coordinate of the lower right box corner
  • y1: y coordinate of the lower right box corner
  • pcolor: color parameter. Valid values: T6963C_BLACK, T6963C_WHITE and T6963C_INVERT.
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

void T6963C_circle(int x, int y, long r, unsigned char pcolor);

Description

Draws a circle on the Glcd.

Parameters
  • x: x coordinate of the circle center
  • y: y coordinate of the circle center
  • r: radius size
  • pcolor: color parameter. Valid values: T6963C_BLACK, T6963C_WHITE and T6963C_INVERT.
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

void T6963C_circle_fill(int x, int y, long r, unsigned char pcolor);

Description

Draws a filled circle on the Glcd.

Parameters
  • x: x coordinate of the circle center
  • y: y coordinate of the circle center
  • r: radius size
  • pcolor: color parameter. Valid values: T6963C_BLACK, T6963C_WHITE and T6963C_INVERT.
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

void T6963C_image(const code char *pic);

Description

Displays bitmap on Glcd.

Parameters
  • pic: image to be displayed. Bitmap array can be located in both code and RAM memory (due to the mikroC PRO for PIC32 pointer to const and pointer to RAM equivalency).
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

void T6963C_Ext_Image(unsigned long image);

Description

Displays a bitmap from an external resource.

Parameters
  • pic: image to be displayed. This parameter represents the address in the exteral resource from where the image data begins.
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

void T6963C_PartialImage(unsigned int x_left, unsigned int y_top, unsigned int width, unsigned int height, unsigned int picture_width, unsigned int picture_height, code const far char image);

Description

Displays a partial area of the image on a desired location.

Parameters
  • x_left: x coordinate of the desired location (upper left coordinate).
  • y_top: y coordinate of the desired location (upper left coordinate).
  • width: desired image width.
  • height: desired image height.
  • picture_width: width of the original image.
  • picture_height: height of the original image.
  • image: image to be displayed. Bitmap array can be located in both code and RAM memory (due to the mikroC PRO for PIC32 pointer to const and pointer to RAM equivalency).
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

void T6963C_Ext_PartialImage(unsigned int x_left, unsigned int y_top, unsigned int width, unsigned int height, unsigned int picture_width, unsigned int picture_height, unsigned long image);

Description

Displays a partial area of the image (from an external resource) on a desired location.

Parameters
  • x_left: x coordinate of the desired location (upper left coordinate).
  • y_top: y coordinate of the desired location (upper left coordinate).
  • width: desired image width.
  • height: desired image height.
  • picture_width: width of the original image.
  • picture_height: height of the original image.
  • image: image to be displayed. This parameter represents the address in the exteral resource from where the image data begins.
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

void T6963C_sprite(unsigned char px, unsigned char py, const code char *pic, unsigned char sx, unsigned char sy);

Description

Fills graphic rectangle area (px, py) to (px+sx, py+sy) with custom size picture.

Parameters
  • px: x coordinate of the upper left picture corner. Valid values: multiples of the font width
  • py: y coordinate of the upper left picture corner
  • pic: picture to be displayed
  • sx: picture width. Valid values: multiples of the font width
  • sy: picture height
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 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.

T6963C_set_cursor

Prototype

void T6963C_set_cursor(unsigned char x, unsigned char y);

Description

Sets cursor to row x and column y.

Parameters
  • x: cursor position row number
  • y: cursor position column number
Returns

Nothing.

Requires

Toshiba Glcd module needs to be initialized. See the T6963C_init routine.

Example
T6963C_set_cursor(cposx, cposy);
Notes

None.

T6963C_clearBit

Prototype

void T6963C_clearBit(unsigned int b);

Description

Clears control port bit(s).

Parameters
  • b: bit mask. The function will clear bit x on control port if bit x in bit mask is set to 1.
Returns

Nothing.

Requires

Toshiba Glcd module needs to be initialized. See the T6963C_init routine.

Example
// clear bits 0 and 1 on control port
T6963C_clearBit(0x0003);
Notes

None.

T6963C_setBit

Prototype

void T6963C_setBit(unsigned int b);

Description

Sets control port bit(s).

Parameters
  • b: bit mask. The function will set bit x on control port if bit x in bit mask is set to 1.
Returns

Nothing.

Requires

Toshiba Glcd module needs to be initialized. See the T6963C_init routine.

Example
// set bits 0 and 1 on control port
T6963C_setBit(0x0003);
Notes

None.

T6963C_negBit

Prototype

void T6963C_negBit(unsigned int b);

Description

Negates control port bit(s).

Parameters
  • b: bit mask. The function will negate bit x on control port if bit x in bit mask is set to 1.
Returns

Nothing.

Requires

Toshiba Glcd module needs to be initialized. See the T6963C_init routine.

Example
// negate bits 0 and 1 on control port
T6963C_negBit(0x0003);
Notes

None.

T6963C_displayGrPanel

Prototype

void T6963C_displayGrPanel(unsigned int n);

Description

Display selected graphic panel.

Parameters
  • n: graphic panel number. Valid values: 0 and 1.
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

void T6963C_displayTxtPanel(unsigned int n);

Description

Display selected text panel.

Parameters
  • n: text panel number. Valid values: 0 and 1.
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

void T6963C_setGrPanel(unsigned int n);

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
  • n: graphic panel number. Valid values: 0 and 1.
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

void T6963C_setTxtPanel(unsigned int n);

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
  • n: text panel number. Valid values: 0 and 1.
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

void T6963C_panelFill(unsigned char v);

Description

Fill current panel in full (graphic+text) with appropriate value (0 to clear).

Parameters
  • v: value to fill panel with.
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

void T6963C_grFill(unsigned char v);

Description

Fill current graphic panel with appropriate value (0 to clear).

Parameters
  • v: value to fill graphic panel with.
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

void T6963C_txtFill(unsigned char v);

Description

Fill current text panel with appropriate value (0 to clear).

Parameters
  • v: this value increased by 32 will be used to fill text panel.
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

void T6963C_cursor_height(unsigned char n);

Description

Set cursor size.

Parameters
  • n: cursor height. Valid values: 0..7.
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

void T6963C_graphics(unsigned int n);

Description

Enable/disable graphic displaying.

Parameters
  • n: graphic enable/disable parameter. Valid values: 0 (disable graphic dispaying) and 1 (enable graphic displaying).
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

void T6963C_text(unsigned int n);

Description

Enable/disable text displaying.

Parameters
  • n: on/off parameter. Valid values: 0 (disable text displaying) and 1 (enable text displaying).
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

void T6963C_cursor(unsigned int n);

Description

Set cursor on/off.

Parameters
  • n: on/off parameter. Valid values: 0 (set cursor off) and 1 (set cursor on).
Returns

Nothing.

Requires

Toshiba Glcd module needs to be initialized. See the T6963C_init routine.

Example
// set cursor on
T6963C_cursor(1);
Notes

None.

Prototype

void T6963C_cursor_blink(unsigned int n);

Description

Enable/disable cursor blinking.

Parameters
  • n: cursor blinking enable/disable parameter. Valid values: 0 (disable cursor blinking) and 1 (enable cursor blinking).
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. Hardware configurations in this example are made for the LV-32MX v6 board and PIC32MX460F512L.

Copy Code To ClipboardCopy Code To Clipboard
#include        "__T6963C.h"

// T6963C module connections
unsigned long T6963C_dataPort at PORTD;          // DATA port
unsigned long T6963C_cntlPort at PORTE;          // CTRL port

sbit T6963C_ctrlwr  at LATE2_bit;                // WR write signal
sbit T6963C_ctrlrd  at LATE1_bit;                // RD read signal
sbit T6963C_ctrlcd  at LATE0_bit;                // CD command/data signal
sbit T6963C_ctrlrst at LATE4_bit;                // RST reset signal
sbit T6963C_ctrlwr_Direction  at TRISE2_bit;     // WR write signal
sbit T6963C_ctrlrd_Direction  at TRISE1_bit;     // RD read signal
sbit T6963C_ctrlcd_Direction  at TRISE0_bit;     // CD command/data signal
sbit T6963C_ctrlrst_Direction at TRISE4_bit;     // RST reset signal

// Signals not used by library, they are set in main function
sbit T6963C_ctrlce at LATE3_bit;                 // CE signal
sbit T6963C_ctrlfs at LATE6_bit;                 // FS signal
sbit T6963C_ctrlmd at LATE5_bit;                 // MD signal
sbit T6963C_ctrlce_Direction  at TRISE3_bit;     // CE signal direction
sbit T6963C_ctrlfs_Direction  at TRISE6_bit;     // FS signal direction
sbit T6963C_ctrlmd_Direction  at TRISE5_bit;     // MD signal direction
// End T6963C module connections

/*
 * bitmap pictures stored in ROM
 */
const code char mikroE_240x128_bmp[];
const code char einstein[];


void main() {
  #define COMPLETE_EXAMPLE
  #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

  char txt1[] = " EINSTEIN WOULD HAVE LIKED mE";
  char txt[] =  " GLCD LIBRARY DEMO, WELCOME !";
  char txt2[] = "Partial image demo!";

  unsigned char  panel;         // Current panel
  unsigned int   i;             // General purpose register
  unsigned char  curs;          // Cursor visibility
  unsigned int   cposx, cposy;  // Cursor x-y position

  CHECON = 0x32;
  AD1PCFG = 0xFFFF;

  TRISB8_bit = 1;               // Set RB8 as input
  TRISB9_bit = 1;               // Set RB9 as input
  TRISB10_bit = 1;              // Set RB10 as input
  TRISB11_bit = 1;              // Set RB11 as input
  TRISB12_bit = 1;              // Set RB12 as input
  TRISB13_bit = 1;              // Set RC13 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


  // Initialize T6963C
  T6963C_init(240, 128, 8);

  /*
   * Enable both graphics and text display at the same time
   */
  T6963C_graphics(1);
  T6963C_text(1);

  panel = 0;
  i = 0;
  curs = 0;
  cposx = cposy = 0;

  /*
   * 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);

  for(;;) {                                        // Endless loop

    /*
     * If RB8 is pressed, display only graphic panel
     */
    if(RB8_bit) {
      T6963C_graphics(1);
      T6963C_text(0);
      Delay_ms(300);
    }
    /*
     * If RB9 is pressed, toggle the display between graphic panel 0 and graphic panel 1
     */
    else if(RB9_bit) {
      panel++;
      panel &= 1;
      T6963C_displayGrPanel(panel);
      Delay_ms(300);
    }

    /*
     * If RB10 is pressed, display only text panel
     */
    else if(RB10_bit) {
      T6963C_graphics(0);
      T6963C_text(1);
      Delay_ms(300);
    }

    /*
     * If RB11 is pressed, display text and graphic panels
     */
    else if(RB11_bit) {
      T6963C_graphics(1);
      T6963C_text(1);
      Delay_ms(300);
    }
    /*
     * If RB12 is pressed, change cursor
     */
    else if(RB12_bit) {
      curs++;
      if(curs == 3) curs = 0;
      switch(curs) {
        case 0:
          // no cursor
          T6963C_cursor(0);
          break;
        case 1:
          // blinking cursor
          T6963C_cursor(1);
          T6963C_cursor_blink(1);
          break;
        case 2:
          // non blinking cursor
          T6963C_cursor(1);
          T6963C_cursor_blink(0);
          break;
      }
      Delay_ms(300);
    }

    #ifdef PARTIAL_IMAGE_DEMO
    /*
     * If RC13 is pressed, perform the "Partial image" demostration
     */
    else if(RB13_bit) {
      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_1sec();
      T6963C_PartialImage(0, 0, 128, 128, 240, 128, mikroE_240x128_bmp);
      Delay_1sec();
      T6963C_PartialImage(0, 0, 240, 128, 240, 128, mikroE_240x128_bmp);
      Delay_1sec();
      T6963C_txtFill(0);
      T6963C_write_text(txt, 0, 0, T6963C_ROM_MODE_XOR);
      T6963C_write_text(txt1, 0, 15, T6963C_ROM_MODE_XOR);
    }
    #endif

    /*
     * Move cursor, even if not visible
     */
    cposx++;
    if(cposx == T6963C_txtCols) {
      cposx = 0;
      cposy++;
      if(cposy == T6963C_grHeight / T6963C_CHARACTER_HEIGHT) {
        cposy = 0;
      }
    }
    T6963C_set_cursor(cposx, cposy);

    Delay_ms(100);
  }
}

HW Connection

T6963C Glcd HW connection

T6963C Glcd HW connection

Copyright (c) 2002-2017 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code