SPI T6963C Graphic Lcd Library

The mikroC PRO for 8051 provides a library for working with Glcds based on TOSHIBA T6963C controller via SPI interface. 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 this controller is small, it has a capability of displaying and merging text and graphics and it manages all interfacing signals to the displays Row and Column drivers.

For creating a custom set of Glcd images use Glcd Bitmap Editor Tool.

Note:

Adapter Board T6369C datasheet
RS C/D
R/W /RD
E /WR

External dependencies of SPI T6963C Graphic Lcd Library

The implementation of SPI T6963C Graphic Lcd Library routines is based on Port Expander Library routines.

External dependencies are the same as Port Expander Library external dependencies.

Library Routines

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

SPI_T6963C_Config

Prototype

void SPI_T6963C_Config(unsigned int width, unsigned char height, unsigned char fntW, char DeviceAddress, unsigned char wr, unsigned char rd, unsigned char cd, unsigned char rst);

Returns

Nothing.

Description

Initializes T6963C Graphic Lcd controller.

Parameters :

  • width: width of the Glcd panel
  • height: height of the Glcd panel
  • fntW: font width
  • DeviceAddress: SPI expander hardware address, see schematic at the bottom of this page
  • wr: write signal pin on Glcd control port
  • rd: read signal pin on Glcd control port
  • cd: command/data signal pin on Glcd control port
  • rst: reset signal pin on Glcd control port

Display RAM organization:
The library cuts RAM into panels : a complete panel is one graphics panel followed by a text panel (see schematic below).

schematic:
+---------------------+ /\
+ GRAPHICS PANEL #0   +  |
+                     +  |
+                     +  |
+                     +  |
+---------------------+  | PANEL 0
+ TEXT PANEL #0       +  |
+                     + \/
+---------------------+ /\
+ GRAPHICS PANEL #1   +  |
+                     +  |
+                     +  |
+                     +  |
+---------------------+  | PANEL 1
+ TEXT PANEL #1       +  |
+                     +  |
+---------------------+ \/            	
            
Requires

SPExpanderCS and SPExpanderRST variables must be defined before using this function.

The SPI module needs to be initialized. See the SPIx_Init and SPIx_Init_Advanced routines.

Example
// port expander pinout definition
sbit  SPExpanderRST at P1_0_bit;
sbit  SPExpanderCS  at P1_1_bit;
...
SPI1_Init_Advanced(_SPI_FCY_DIV4 | _SPI_CLK_IDLE_LO | _SPI_CLK_IDLE_2_ACTIVE); // Initialize SPI module
SPI_T6963C_Config(240, 64, 8, 0, 0, 1, 3, 4) ;

SPI_T6963C_WriteData

Prototype

void SPI_T6963C_WriteData(unsigned char Ddata);

Returns

Nothing.

Description

Writes data to T6963C controller via SPI interface.

Parameters :

  • Ddata: data to be written

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_WriteData(AddrL);

SPI_T6963C_WriteCommand

Prototype

void SPI_T6963C_WriteCommand(unsigned char Ddata);

Returns

Nothing.

Description

Writes command to T6963C controller via SPI interface.

Parameters :

  • Ddata: command to be written

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_WriteCommand(_SPI_T6963C_CURSOR_POINTER_SET);

SPI_T6963C_SetPtr

Prototype

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

Returns

Nothing.

Description

Sets the memory pointer p for command c.

Parameters :

  • p: address where command should be written
  • c: command to be written

Requires

SToshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_SetPtr(T6963C_grHomeAddr + start, T6963C_ADDRESS_POINTER_SET);

SPI_T6963C_WaitReady

Prototype

void SPI_T6963C_WaitReady(void);

Returns

Nothing.

Description

Pools the status byte, and loops until Toshiba Glcd module is ready.

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_WaitReady();

SPI_T6963C_Fill

Prototype

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

Returns

Nothing.

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

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_Fill(0x33,0x00FF,0x000F);

SPI_T6963C_Dot

Prototype

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

Returns

Nothing.

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: SPI_T6963C_BLACK and SPI_T6963C_WHITE

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_Dot(x0, y0, pcolor);

SPI_T6963C_Write_Char

Prototype

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

Returns

Nothing.

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: SPI_T6963C_ROM_MODE_OR, SPI_T6963C_ROM_MODE_XOR, SPI_T6963C_ROM_MODE_AND and SPI_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 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.

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_Write_Char("A",22,23,AND);

SPI_T6963C_Write_Text

Prototype

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

Returns

Nothing.

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: SPI_T6963C_ROM_MODE_OR, SPI_T6963C_ROM_MODE_XOR, SPI_T6963C_ROM_MODE_AND and SPI_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 negative mode, i.e. white text on black background.
  • AND-Mode: The text and graphic data shown on the 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.

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_Write_Text("GLCD LIBRARY DEMO, WELCOME !", 0, 0, T6963C_ROM_MODE_EXOR);

SPI_T6963C_Line

Prototype

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

Returns

Nothing.

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: SPI_T6963C_BLACK and SPI_T6963C_WHITE

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_Line(0, 0, 239, 127, T6963C_WHITE);

SPI_T6963C_Rectangle

Prototype

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

Returns

Nothing.

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: SPI_T6963C_BLACK and SPI_T6963C_WHITE

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_Rectangle(20, 20, 219, 107, T6963C_WHITE);

SPI_T6963C_Box

Prototype

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

Returns

Nothing.

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: SPI_T6963C_BLACK and SPI_T6963C_WHITE

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_Box(0, 119, 239, 127, T6963C_WHITE);

SPI_T6963C_Circle

Prototype

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

Returns

Nothing.

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: SPI_T6963C_BLACK and SPI_T6963C_WHITE

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_Circle(120, 64, 110, T6963C_WHITE);

SPI_T6963C_Image

Prototype

void SPI_T6963C_Image(const code char *pic);

Returns

Nothing.

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 8051 pointer to const and pointer to RAM equivalency).

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 SPI_T6963C_Config routine.

Example
SPI_T6963C_Image(my_image);

SPI_T6963C_Sprite

Prototype

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

Returns

Nothing.

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

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 SPI_T6963C_Config routine.

Example
SPI_T6963C_Sprite(76, 4, einstein, 88, 119); // draw a sprite

SPI_T6963C_Set_Cursor

Prototype

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

Returns

Nothing.

Description

Sets cursor to row x and column y.

Parameters :

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

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_Set_Cursor(cposx, cposy);

SPI_T6963C_ClearBit

Prototype

void SPI_T6963C_ClearBit(char b);

Returns

Nothing.

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.

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// clear bits 0 and 1 on control port
SPI_T6963C_ClearBit(0x03);

SPI_T6963C_SetBit

Prototype

void SPI_T6963C_SetBit(char b);

Returns

Nothing.

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.

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// set bits 0 and 1 on control port
SPI_T6963C_SetBit(0x03);

SPI_T6963C_NegBit

Prototype

void SPI_T6963C_NegBit(char b);

Returns

Nothing.

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.

Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// negate bits 0 and 1 on control port
SPI_T6963C_NegBit(0x03);

SPI_T6963C_DisplayGrPanel

Prototype

void SPI_T6963C_DisplayGrPanel(char n);

Returns

Nothing.

Description

Display selected graphic panel.

Parameters :

  • n: graphic panel number. Valid values: 0 and 1.
Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// display graphic panel 1
SPI_T6963C_DisplayGrPanel(1);

SPI_T6963C_DisplayTxtPanel

Prototype

void SPI_T6963C_DisplayTxtPanel(char n);

Returns

Nothing.

Description

Display selected text panel.

Parameters :

  • n: text panel number. Valid values: 0 and 1.
Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// display text panel 1
SPI_T6963C_DisplayTxtPanel(1);

SPI_T6963C_SetGrPanel

Prototype

void SPI_T6963C_SetGrPanel(char n);

Returns

Nothing.

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.
Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// set graphic panel 1 as current graphic panel.
SPI_T6963C_SetGrPanel(1);

SPI_T6963C_SetTxtPanel

Prototype

void SPI_T6963C_SetTxtPanel(char n);

Returns

Nothing.

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.
Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// set text panel 1 as current text panel.
SPI_T6963C_SetTxtPanel(1);

SPI_T6963C_PanelFill

Prototype

void SPI_T6963C_PanelFill(unsigned char v);

Returns

Nothing.

Description

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

Parameters :

  • v: value to fill panel with.
Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
clear current panel
SPI_T6963C_PanelFill(0);

SPI_T6963C_GrFill

Prototype

void SPI_T6963C_GrFill(unsigned char v);

Returns

Nothing.

Description

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

Parameters :

  • v: value to fill graphic panel with.
Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// clear current graphic panel
SPI_T6963C_GrFill(0);

SPI_T6963C_TxtFill

Prototype

void SPI_T6963C_TxtFill(unsigned char v);

Returns

Nothing.

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.
Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// clear current text panel
SPI_T6963C_TxtFill(0);

SPI_T6963C_Cursor_Height

Prototype

void SPI_T6963C_Cursor_Height(unsigned char n);

Returns

Nothing.

Description

Set cursor size.

Parameters :

  • n: cursor height. Valid values: 0..7.
Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
SPI_T6963C_Cursor_Height(7);

SPI_T6963C_Graphics

Prototype

void SPI_T6963C_Graphics(char n);

Returns

Nothing.

Description

Enable/disable graphic displaying.

Parameters :

  • n: graphic enable/disable parameter. Valid values: 0 (disable graphic dispaying) and 1 (enable graphic displaying).
Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// enable graphic displaying
SPI_T6963C_Graphics(1);

SPI_T6963C_Text

Prototype

void SPI_T6963C_Text(char n);

Returns

Nothing.

Description

Enable/disable text displaying.

Parameters :

  • n: text enable/disable parameter. Valid values: 0 (disable text dispaying) and 1 (enable text displaying).
Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// enable text displaying
SPI_T6963C_Text(1);

SPI_T6963C_Cursor

Prototype

void SPI_T6963C_Cursor(char n);

Returns

Nothing.

Description

Set cursor on/off.

Parameters :

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

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// set cursor on
SPI_T6963C_Cursor(1);
Prototype

void SPI_T6963C_Cursor_Blink(char n);

Returns

Nothing.

Description

Enable/disable cursor blinking.

Parameters :

  • n: cursor blinking enable/disable parameter. Valid values: 0 (disable cursor blinking) and 1 (enable cursor blinking).
Requires

Toshiba Glcd module needs to be initialized. See SPI_T6963C_Config routine.

Example
// enable cursor blinking
SPI_T6963C_Cursor_Blink(1);

Library Example

The following drawing demo tests advanced routines of the SPI T6963C Glcd library. Hardware configurations in this example are made for the T6963C 240x128 display, Easy8051B board and AT89S8253.

#include        "__SPIT6963C.h"

// Port Expander module connections
sbit SPExpanderRST at P1_0_bit;
sbit SPExpanderCS  at P1_1_bit;
// End Port Expander module connections

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


void main() {
  char idata txt1[] = " EINSTEIN WOULD HAVE LIKED mE";
  char idata txt[] =  " GLCD LIBRARY DEMO, WELCOME !";

  unsigned char  panel;         // Current panel
  unsigned int   i;             // General purpose register
  unsigned char  curs;          // Cursor visibility
  unsigned int   cposx, cposy;  // Cursor x-y position
  
  #define COMPLETE_EXAMPLE      // comment this line to make simpler/smaller example
  
  
  // If SPI_T6963C Library uses SPI1 module
  SPI1_Init_Advanced(_SPI_FCY_DIV4 | _SPI_CLK_IDLE_LO | _SPI_CLK_IDLE_2_ACTIVE); // Initialize SPI module

//  // If SPI_T6963C Library uses SPI2 module
//  SPI2_Init_Advanced(_SPI_FCY_DIV4 | _SPI_CLK_IDLE_LO | _SPI_CLK_IDLE_2_ACTIVE); // Initialize SPI module
  
  /*
   * init display for 240 pixel width and 128 pixel height
   * 8 bits character width
   * data bus on MCP23S17 portB
   * control bus on MCP23S17 portA
   * bit 2 is !WR
   * bit 1 is !RD
   * bit 0 is !CD
   * bit 4 is RST
   * chip enable, reverse on, 8x8 font internaly set in library
   */
  SPI_T6963C_Config(240, 128, 8, 0, 2, 1, 0, 4);
  Delay_ms(1000);

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

  panel = 0;
  i = 0;
  curs = 0;
  cposx = cposy = 0;
  /*
   * Text messages
   */
  SPI_T6963C_write_text(txt, 0, 0, SPI_T6963C_ROM_MODE_XOR);
  SPI_T6963C_write_text(txt1, 0, 15, SPI_T6963C_ROM_MODE_XOR);

  /*
   * Cursor
   */
  SPI_T6963C_cursor_height(8);       // 8 pixel height
  SPI_T6963C_set_cursor(0, 0);       // move cursor to top left
  SPI_T6963C_cursor(0);              // cursor off
  
  #ifdef COMPLETE_EXAMPLE
  /*
   * Draw rectangles
   */
  SPI_T6963C_rectangle(0, 0, 239, 127, SPI_T6963C_WHITE);
  SPI_T6963C_rectangle(20, 20, 219, 107, SPI_T6963C_WHITE);
  SPI_T6963C_rectangle(40, 40, 199, 87, SPI_T6963C_WHITE);
  SPI_T6963C_rectangle(60, 60, 179, 67, SPI_T6963C_WHITE);

  /*
   * Draw a cross
   */
  SPI_T6963C_line(0, 0, 239, 127, SPI_T6963C_WHITE);
  SPI_T6963C_line(0, 127, 239, 0, SPI_T6963C_WHITE);

  /*
   * Draw solid boxes
   */
  SPI_T6963C_box(0, 0, 239, 8, SPI_T6963C_WHITE);
  SPI_T6963C_box(0, 119, 239, 127, SPI_T6963C_WHITE);

  /*
   * Draw circles
   */
  SPI_T6963C_circle(120, 64, 10, SPI_T6963C_WHITE);
  SPI_T6963C_circle(120, 64, 30, SPI_T6963C_WHITE);
  SPI_T6963C_circle(120, 64, 50, SPI_T6963C_WHITE);
  SPI_T6963C_circle(120, 64, 70, SPI_T6963C_WHITE);
  SPI_T6963C_circle(120, 64, 90, SPI_T6963C_WHITE);
  SPI_T6963C_circle(120, 64, 110, SPI_T6963C_WHITE);
  SPI_T6963C_circle(120, 64, 130, SPI_T6963C_WHITE);

  SPI_T6963C_sprite(76, 4, einstein, 88, 119);            // Draw a sprite

  SPI_T6963C_setGrPanel(1);                               // Select other graphic panel

  SPI_T6963C_image(mikroE_240x128_bmp);                   // Draw an image

  #endif

  for(;;) {                                               // Endless loop
     /*
      * If P0.0 is pressed, display only graphic panel
      */
    if(!P0_0_bit) {
      SPI_T6963C_graphics(1);
      SPI_T6963C_text(0);
      Delay_ms(300);
    }
    #ifdef COMPLETE_EXAMPLE
     /*
      * If P0.1 is pressed, toggle the display between graphic panel 0 and graphic panel 1
      */
    else if(!P0_1_bit) {
      panel++;
      panel &= 1;
      SPI_T6963C_displayGrPanel(panel);
      Delay_ms(300);
    }
    #endif
    /*
     * If P0.2 is pressed, display only text panel
     */
    else if(!P0_2_bit) {
      SPI_T6963C_graphics(0);
      SPI_T6963C_text(1);
      Delay_ms(300);
    }

    /*
     * If P0.3 is pressed, display text and graphic panels
     */
    else if(!P0_3_bit) {
      SPI_T6963C_graphics(1);
      SPI_T6963C_text(1);
      Delay_ms(300);
    }
    /*
     * If P0.4 is pressed, change cursor
     */
    else if(!P0_4_bit) {
      curs++;
      if(curs == 3) curs = 0;
      switch(curs) {
        case 0:
          // no cursor
          SPI_T6963C_cursor(0);
          break;
        case 1:
          // blinking cursor
          SPI_T6963C_cursor(1);
          SPI_T6963C_cursor_blink(1);
          break;
        case 2:
          // non blinking cursor
          SPI_T6963C_cursor(1);
          SPI_T6963C_cursor_blink(0);
          break;
      }
      Delay_ms(300);
    }

    /*
     * Move cursor, even if not visible
     */
    cposx++;
    if(cposx == SPI_T6963C_txtCols) {
      cposx = 0;
      cposy++;
      if(cposy == SPI_T6963C_grHeight / SPI_T6963C_CHARACTER_HEIGHT) {
        cposy = 0;
        }
      }
    SPI_T6963C_set_cursor(cposx, cposy);

    Delay_ms(100);
    }
}

HW Connection

SPI T6963C Glcd HW connection

SPI T6963C Glcd HW connection

Copyright (c) 2002-2013 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