1731 views|0 replies

3180

Posts

0

Resources
The OP
 

T6963C does not display the problem [Copy link]

void lcdinit() //LCD initialization

{

lcdcmd0(0x80); //Set the display mode, text or graphics

lcdcmd2(0x00,0x00,0x42); //Set the cursor first address

lcdcmd2(30,0x00,0x43); //Set the width of the graphics area

lcdcmd2(0x00,0x00,0x40); //Set the first address of the text display area

lcdcmd2(30,0x00,0x41); ////Set the text area width

lcdcmd0(0x9f); //Set cursor to blink, not display, text and graphics display

lcdcmd0(0xa2); //Set the cursor shape

lcdcmd2(0x00,0x00,0x21); //Set the cursor pointer

lcdcmd2(0x00,0x00,0x22); //Set CGRAM offset address

lcdcmd2(0x00,0x00,0x24); //Set address pointer

}

Now the cursor can be displayed, but no characters are displayed.

Main program:

lcdinit();

dis_clr(0);//Clear screen

write_lcd(16,0,"123abc----------");

The function to display characters is as follows:

//---------------------------------------------

// Write the specified character to the LCD at the specified position

//

//

//---------------------------------------------

void write_lcd(uchar x,uchar y,char *cha)

{

uint place,i=0;

uchar length,c1,c2,j,k;

for(length=0;cha[length]!=0;length++);

do

{

c1=cha[i]; //Get the ASCII code of the string

c2=cha[i+1];

place=x*30+y;

if(c1<=128) //######Less than 128 is a character, greater than 128 is a Chinese character

{

for(k=0;k<16;++k) //Character is set to 16*8

{

lcddatw(place&0xff); //Write to the low bit of the address

lcddatw(place/256); //Write to the high bit of the address

lcdcmd0(0x24); //Address setting

lcdcmd0(0xb0); //Set data to write automatically

lcddatw(ASC_MSK[(c1-0x20)*16+k]); /*---For example: the ASCII code of 0 is 0x30,

The position in ASC_MSK is 0x10*16 --- 16 bytes of code are written to LCD in sequence --- */

lcdcmd0(0xb2); //auto reset

place=place+30;

}

if(y>28) //When y>28, a line break is required

{x=x+16;y=0;}

else //Otherwise, do not wrap and continue to write the next character

{y++;}

i++;

}

else //#####c1 is greater than 128 and is a Chinese character

{

for(j=0;j<sizeof(GB_16)/sizeof(GB_16[0]);j++) //Find Chinese characters

{

if(c1==GB_16[j].Index[0]&&c2==GB_16[j].Index[1])

break; //jump out if Chinese characters are found

}

if(j<sizeof(GB_16)/sizeof(GB_16[0])) //------If the Chinese character is in the subcode table

{

for(k=0;k<16;k++) //Character is set to 16*8

{

lcddatw(place&0xff); //Write to the low bit of the address

lcddatw(place/256); //Write to the high bit of the address

lcdcmd0(0x24); //Address setting

lcdcmd0(0xb0); //Address setting

lcddatw(GB_16[j].Msk[k*2]);

lcddatw(GB_16[j].Msk[k*2+1]); //16*16, 2 bytes per line

lcdcmd0(0xb2); //auto reset

place=place+30; //next line

}

}

else //-----If no corresponding Chinese character is found, blacken it

{

for(k=0;k<16;k++) //Character is set to 16*8

{

lcddatw(place&0xff); //Write to the low bit of the address

lcddatw(place/256); //Write to the high bit of the address

lcdcmd0(0x24); //Address setting

lcdcmd0(0xb0); //Address setting

lcddatw(0xff);

lcddatw(0xff);

lcdcmd0(0xb2); //auto reset

place=place+30; //next line

}

}

if(y>27) //-------line break

{x+=16;y=0;}

else //--------No line break, then the next word

{y+=2;}

i+=2;

}

}

while(i<length);

}

Please give me some advice, thank you!

This post is from 51mcu
Personal signature为江山踏坏了乌骓马,为社稷拉断了宝雕弓。
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list