T6963C Graphic Lcd Library
The mikroC PRO for AVR 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.

- 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
The following variables must be defined in all projects using T6963C Graphic Lcd library: | Description : | Example : |
---|---|---|
extern sfr char T6963C_dataPort; |
T6963C Data Port. | char T6963C_dataPort at PORTD; |
extern sfr char T6963C_dataPort_Direction; |
Direction of the T6963C Data Port. | char T6963C_dataPort_Direction at DDRD; |
extern sfr sbit T6963C_ctrlwr; |
Write signal. | sbit T6963C_ctrlwr at PORTC2_bit; |
extern sfr sbit T6963C_ctrlrd; |
Read signal. | sbit T6963C_ctrlrd at PORTC1_bit; |
extern sfr sbit T6963C_ctrlcd; |
Command/Data signal. | sbit T6963C_ctrlcd at PORTC0_bit; |
extern sfr sbit T6963C_ctrlrst; |
Reset signal. | sbit T6963C_ctrlrst at PORTC4_bit; |
extern sfr sbit T6963C_ctrlwr_Direction; |
Direction of the Write pin. | sbit T6963C_ctrlwr_Direction at DDC2_bit; |
extern sfr sbit T6963C_ctrlrd_Direction; |
Direction of the Read pin. | sbit T6963C_ctrlrd_Direction at DDC1_bit; |
extern sfr sbit T6963C_ctrlcd_Direction; |
Direction of the Command/Data pin. | sbit T6963C_ctrlcd_Direction at DDC0_bit; |
extern sfr sbit T6963C_ctrlrst_Direction; |
Direction of the Reset pin. | sbit T6963C_ctrlrst_Direction at DDC4_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
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_clearBit
- T6963C_setBit
- T6963C_negBit
- 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 |
void T6963C_init(unsigned int width, unsigned char height, unsigned char fntW); |
---|---|
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 char T6963C_dataPort at PORTD; // DATA port char T6963C_dataPort_Direction at DDRD; // DATA direction register sbit T6963C_ctrlwr at PORTC2_bit; // WR write signal sbit T6963C_ctrlrd at PORTC1_bit; // RD read signal sbit T6963C_ctrlcd at PORTC0_bit; // CD command/data signal sbit T6963C_ctrlrst at PORTC4_bit; // RST reset signal sbit T6963C_ctrlwr_Direction at DDC2_bit; // WR write signal sbit T6963C_ctrlrd_Direction at DDC1_bit; // RD read signal sbit T6963C_ctrlcd_Direction at DDC0_bit; // CD command/data signal sbit T6963C_ctrlrst_Direction at DDC4_bit; // RST reset signal // End 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 |
void T6963C_writeData(unsigned char mydata); |
---|---|
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 |
void T6963C_writeCommand(unsigned char mydata); |
---|---|
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 |
void T6963C_setPtr(unsigned int p, unsigned char c); |
---|---|
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 |
void T6963C_Set_Ext_Buffer(char* (*getExtDataPtr)(unsigned long offset, unsigned int count, unsigned int *num)); |
---|---|
Returns |
Nothing. |
Description |
Function sets pointer to the user function which manipulates the external resource. Parameters :
|
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(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 the T6963C_init routine. |
Example |
T6963C_waitReady(); |
T6963C_fill
Prototype |
void T6963C_fill(unsigned char v, unsigned int start, unsigned int len); |
---|---|
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 |
void 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 :
|
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 |
void T6963C_Set_Font_Adv(const far 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 |
|
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 |
|
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); |
---|---|
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 |
void T6963C_write_char_adv(unsigned char c, unsigned char x, unsigned char y); |
---|---|
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 |
void 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 :
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 |
void T6963C_Write_Text_Adv(unsigned char *text, unsigned char x, unsigned char y); |
---|---|
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 |
void T6963C_Write_Const_Text_Adv(unsigned char *text, unsigned char x, unsigned char y); |
---|---|
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 char ctext[] = "mikroElektronika"; ... T6963C_Write_Const_Text_Adv(ctext, 0, 0); |
Notes |
None. |
T6963C_line
Prototype |
void 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 :
|
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 |
void T6963C_rectangle(int x0, int y0, int x1, int y1, unsigned char pcolor); |
---|---|
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 |
void T6963C_rectangle_round_edges(int x0, int y0, int x1, int y1, int round_radius, unsigned char pcolor); |
---|---|
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 |
void T6963C_rectangle_round_edges_fill(int x0, int y0, int x1, int y1, int round_radius, unsigned char pcolor); |
---|---|
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 |
void T6963C_box(int x0, int y0, int x1, int y1, unsigned char pcolor); |
---|---|
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 |
void T6963C_circle(int x, int y, long r, unsigned char pcolor); |
---|---|
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 |
void T6963C_circle_fill(int x, int y, long r, unsigned char pcolor); |
---|---|
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 |
void T6963C_image(const code char *pic); |
---|---|
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. ![]() |
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
T6963C_image(mc); |
T6963C_Ext_Image
Prototype |
void T6963C_Ext_Image(unsigned long image); |
---|---|
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 |
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 unsigned short * image); |
---|---|
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. ![]() |
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 |
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 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 |
void T6963C_sprite(unsigned char px, unsigned char py, const code 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 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 |
void T6963C_set_cursor(unsigned char x, unsigned char y); |
---|---|
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_clearBit
Prototype |
void T6963C_clearBit(char b); |
---|---|
Returns |
Nothing. |
Description |
Clears control port bit(s). Parameters :
|
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// clear bits 0 and 1 on control port T6963C_clearBit(0x03); |
T6963C_setBit
Prototype |
void T6963C_setBit(char b); |
---|---|
Returns |
Nothing. |
Description |
Sets control port bit(s). Parameters :
|
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// set bits 0 and 1 on control port T6963C_setBit(0x03); |
T6963C_negBit
Prototype |
void T6963C_negBit(char b); |
---|---|
Returns |
Nothing. |
Description |
Negates control port bit(s). Parameters :
|
Requires |
Toshiba Glcd module needs to be initialized. See the T6963C_init routine. |
Example |
// negate bits 0 and 1 on control port T6963C_negBit(0x03); |
T6963C_displayGrPanel
Prototype |
void T6963C_displayGrPanel(char n); |
---|---|
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 |
void T6963C_displayTxtPanel(char n); |
---|---|
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 |
void T6963C_setGrPanel(char n); |
---|---|
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 |
void T6963C_setTxtPanel(char n); |
---|---|
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 |
void T6963C_panelFill(unsigned char v); |
---|---|
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 |
void T6963C_grFill(unsigned char v); |
---|---|
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 |
void T6963C_txtFill(unsigned char v); |
---|---|
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 |
void T6963C_cursor_height(unsigned char n); |
---|---|
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 |
void T6963C_graphics(char n); |
---|---|
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 |
void T6963C_text(char n); |
---|---|
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 |
void T6963C_cursor(char n); |
---|---|
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 |
void T6963C_cursor_blink(char n); |
---|---|
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, EasyAVR6 board and ATMEGA16.
#include "__T6963C.h" // T6963C module connections char T6963C_dataPort at PORTD; // DATA port char T6963C_dataPort_Direction at DDRD; // DATA direction register sbit T6963C_ctrlwr at PORTC2_bit; // WR write signal sbit T6963C_ctrlrd at PORTC1_bit; // RD read signal sbit T6963C_ctrlcd at PORTC0_bit; // CD command/data signal sbit T6963C_ctrlrst at PORTC4_bit; // RST reset signal sbit T6963C_ctrlwr_Direction at DDC2_bit; // WR write signal sbit T6963C_ctrlrd_Direction at DDC1_bit; // RD read signal sbit T6963C_ctrlcd_Direction at DDC0_bit; // CD command/data signal sbit T6963C_ctrlrst_Direction at DDC4_bit; // RST reset signal // Signals not used by library, they are set in main function sbit T6963C_ctrlce at PORTC3_bit; // CE signal sbit T6963C_ctrlfs at PORTC6_bit; // FS signal sbit T6963C_ctrlmd at PORTC5_bit; // MD signal sbit T6963C_ctrlce_Direction at DDC3_bit; // CE signal direction sbit T6963C_ctrlfs_Direction at DDC6_bit; // FS signal direction sbit T6963C_ctrlmd_Direction at DDC5_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() { char txt1[] = " EINSTEIN WOULD HAVE LIKED mE"; char 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 DDA0_bit = 0; // Set PA0 as input DDA1_bit = 0; // Set PA1 as input DDA2_bit = 0; // Set PA2 as input DDA3_bit = 0; // Set PA3 as input DDA4_bit = 0; // Set PA4 as input T6963C_ctrlce_Direction = 1; T6963C_ctrlce = 0; // Enable T6963C T6963C_ctrlfs_Direction = 1; T6963C_ctrlfs = 0; // Font Select 8x8 T6963C_ctrlmd_Direction = 1; 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 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); /* * 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_image(mikroE_240x128_bmp); for(;;) { // Endless loop /* * If PA0 is pressed, display only graphic panel */ if(PINA0_bit) { T6963C_graphics(1); T6963C_text(0); Delay_ms(300); } /* * If PA1 is pressed, toggle the display between graphic panel 0 and graphic panel 1 */ else if(PINA1_bit) { panel++; panel &= 1; T6963C_displayGrPanel(panel); Delay_ms(300); } /* * If PA2 is pressed, display only text panel */ else if(PINA2_bit) { T6963C_graphics(0); T6963C_text(1); Delay_ms(300); } /* * If PA3 is pressed, display text and graphic panels */ else if(PINA3_bit) { T6963C_graphics(1); T6963C_text(1); Delay_ms(300); } /* * If PA4 is pressed, change cursor */ else if(PINA4_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); } /* * 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
What do you think about this topic ? Send us feedback!