標題:
一個T6963C 240x128液晶顯示屏測試小程序
[打印本頁]
作者:
oldspring
時間:
2018-10-23 09:05
標題:
一個T6963C 240x128液晶顯示屏測試小程序
T6963C 240x128 液晶顯示屏是由東芝公司生產(chǎn)的產(chǎn)品,也是目前比較流行的顯示屏之一。以下是一個簡單的測試小程序,希望大家能夠喜歡。
#include "__T6963C.h"
// T6963C module connections
char T6963C_dataPort at P3; // DATA port
sbit T6963C_ctrlwr at P2_2_bit; // WR write signal
sbit T6963C_ctrlrd at P2_1_bit; // RD read signal
sbit T6963C_ctrlcd at P2_0_bit; // CD command/data signal
sbit T6963C_ctrlrst at P2_4_bit; // RST reset signal
// Signals not used by library, they are set in main function
sbit T6963C_ctrlce at P2_3_bit; // CE signal
sbit T6963C_ctrlfs at P2_6_bit; // FS signal
sbit T6963C_ctrlmd at P2_5_bit; // MD signal
// End T6963C 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
T6963C_ctrlce = 0; // Enable T6963C
T6963C_ctrlfs = 0; // Font Select 8x8
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);
#ifdef COMPLETE_EXAMPLE
/*
* 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); // Draw an image
#endif
for(;;) { // Endless loop
/*
* If P1.0 is pressed, display only graphic panel
*/
if(!P1_0_bit) {
T6963C_graphics(1);
T6963C_text(0);
Delay_ms(300);
}
#ifdef COMPLETE_EXAMPLE
/*
* If P1.1 is pressed, toggle the display between graphic panel 0 and graphic panel 1
*/
else if(!P1_1_bit) {
panel++;
panel &= 1;
T6963C_displayGrPanel(panel);
Delay_ms(300);
}
#endif
/*
* If P1.2 is pressed, display only text panel
*/
else if(!P1_2_bit) {
T6963C_graphics(0);
T6963C_text(1);
Delay_ms(300);
}
/*
* If P1.3 is pressed, display text and graphic panels
*/
else if(!P1_3_bit) {
T6963C_graphics(1);
T6963C_text(1);
Delay_ms(300);
}
/*
* If P1.4 is pressed, change cursor
*/
else if(!P1_4_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);
}
}
復(fù)制代碼
相關(guān)信息:
http://www.torrancerestoration.com/bbs/dpj-136722-1.html
T6963C.jpg
(37.33 KB, 下載次數(shù): 72)
下載附件
2018-10-23 09:04 上傳
作者:
米花卷
時間:
2021-3-18 14:42
t6963c.h頭文件沒有
作者:
berlin235
時間:
2024-10-14 08:49
沒有底層驅(qū)動
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1