📄 t6963.c
字号:
uchar data i;
for(i=10;i>0;i--)
{
if(( Read_Com() & 0x03) == 0x03)
break;
}
return i;
}
uchar fnST2(void)
{
uchar data i;
for(i=10;i>0;i--)
{
if(( Read_Com() & 0x04) == 0x04)
break;
}
return i;
}
uchar fnST3(void)
{
uchar data i;
for(i=10;i>0;i--)
{
if(( Read_Com() & 0x08) == 0x08)
break;
}
return i;
}
uchar fnST6(void)
{
uchar data i;
for(i=10;i>0;i--)
{
if(( Read_Com() & 0x40) == 0x40)
break;
}
return i;
}
uchar fnPR1(uchar uCmd,uchar uPar1,uchar uPar2)
{
if(fnST01() == 0)
return 1;
Write_Data(uPar1);
if(fnST01() == 0)
return 2;
Write_Data(uPar2);
if(fnST01() == 0)
return 3;
Write_Com(uCmd);
return 0;
}
uchar fnPR11(uchar uCmd,uchar uPar1)
{
if(fnST01() == 0)
return 1;
Write_Data(uPar1);
if(fnST01() == 0)
return 2;
Write_Com( uCmd);
return 0;
}
uchar fnPR12(uchar uCmd)
{
if(fnST01() == 0)
return 1;
Write_Com( uCmd);
return 0;
}
uchar fnPR13(uchar uData)
{
if(fnST3() == 0)
return 1;
Write_Data( uData);
return 0;
}
uchar fnPR2(void)
{
if(fnST01() == 0)
return 1;
return(Read_Data());
}
void fnSetPos(uchar urow, uchar ucol)
{
uint data iPos;
iPos = urow * 30 + ucol;
fnPR1(LC_ADD_POS,iPos & 0xFF,iPos / 256);
gCurRow = urow;
gCurCol = ucol;
}
void cursor(uchar uRow, uchar uCol)
{
fnSetPos(uRow * 16, uCol);
}
void Set_Display_Mode(bit Mode)
{
uint data i;
if(Mode)
{
fnPR12(LC_DIS_SW | 0x00);
fnPR12(LC_AUT_WR);
for(i=0;i<(LCM_Width/8)* LCM_Height;i++)
{
fnST3();
fnPR13(0x00);
}
fnPR12(LC_AUT_OVR);
fnPR12(LC_DIS_SW | 0x08);
}
else
{
fnPR12(LC_DIS_SW | 0x00);
fnPR1(LC_ADD_POS,0x00,0x00);
fnPR12(LC_AUT_WR);
for(i=0;i<(LCM_Width/8)*(LCM_Height/8);i++)
{
fnST3();
fnPR13(0);
}
fnPR12(LC_AUT_OVR);
fnPR12(LC_DIS_SW | 0x06);
}
}
清屏
void Clear(void)
{
uint data i;
Set_Display_Mode(1);
fnPR1(LC_ADD_POS,0x00,0x00);
fnPR12(LC_AUT_WR);
for(i=0;i<(LCM_Width/8)* LCM_Height;i++)
{
fnST3();
fnPR13(0x00);
}
fnPR12(LC_AUT_OVR);
fnPR1(LC_ADD_POS,0x00,0x00);
}
清屏
void Fill_Screen(void)
{
uint data i;
Set_Display_Mode(1);
fnPR1(LC_ADD_POS,0x00,0x00);
fnPR12(LC_AUT_WR);
for(i=0;i<(LCM_Width/8)* LCM_Height;i++)
{
fnST3();
fnPR13(0xff);
}
fnPR12(LC_AUT_OVR);
fnPR1(LC_ADD_POS,0x00,0x00);
}
void Display_Bmp(uchar *bmp_data)
{
uint data i;
Set_Display_Mode(1);
fnPR1(LC_ADD_POS,0x00,0x00);
fnPR12(LC_AUT_WR);
for(i=0;i<(LCM_Width/8)* LCM_Height;i++)
{
fnST3();
fnPR13(*bmp_data++);
}
fnPR12(LC_AUT_OVR);
fnPR1(LC_ADD_POS,0x00,0x00);
}
void Display_Chess(uchar First_Code,uchar Second_Code)
{
uint data i,j;
Set_Display_Mode(1);
fnPR1(LC_ADD_POS,0x00,0x00);
fnPR12(LC_AUT_WR);
for(i=0;i<LCM_Height/2;i++)
{
for(j=0;j<(LCM_Width/8);j++)
{
fnST3();
fnPR13(First_Code);
}
for(j=0;j<(LCM_Width/8);j++)
{
fnST3();
fnPR13(Second_Code);
}
}
fnPR12(LC_AUT_OVR);
fnPR1(LC_ADD_POS,0x00,0x00);
}
void Display_Chess_Fill(void)
{
uint data i,j,k;
Set_Display_Mode(1);
fnPR1(LC_ADD_POS,0x00,0x00);
fnPR12(LC_AUT_WR);
for(i=0;i<LCM_Height/16;i++)
{
for(k=0;k<8;k++)
{
for(j=0;j<(LCM_Width/16);j++)
{
fnST3();
fnPR13(0xff);
fnST3();
fnPR13(0x00);
}
}
for(k=0;k<8;k++)
{
for(j=0;j<(LCM_Width/16);j++)
{
fnST3();
fnPR13(0x00);
fnST3();
fnPR13(0xff);
}
}
}
fnPR12(LC_AUT_OVR);
fnPR1(LC_ADD_POS,0x00,0x00);
}
/
void Display_Lib(void)
{
uint data i;
uchar s;
Set_Display_Mode(0);
fnPR1(LC_ADD_POS,0x00,0x00);
fnPR12(LC_AUT_WR);
s = 0;
for(i=0;i<0x80;i++)
{
fnST3();
fnPR13(s++);
}
fnPR12(LC_AUT_OVR);
fnPR1(LC_ADD_POS,0x00,0x00);
gCurRow = 0;
gCurCol = 0;
}
void Display_Same_character(uchar charac_code,bit Pause,uint Number)
{
uint data i;
Set_Display_Mode(0);
fnPR1(LC_ADD_POS,0x00,0x00);
fnPR12(LC_AUT_WR);
for(i=0;i<Number;i++)
{
fnST3();
fnPR13(charac_code);
if(Pause)
Timer0_Delay(10);
}
fnPR12(LC_AUT_OVR);
}
char fnLCMInit(void)
{
RST = 1;
Timer0_Delay(10);
RST = 0;
Timer0_Delay(250);
Timer0_Delay(250);
RST = 1;
Timer0_Delay(250);
if(fnPR1(LC_TXT_STP,0x00,0x00) != 0)
return -1;
fnPR1(LC_TXT_WID,0x14,0x00);
fnPR1(LC_GRH_STP,0x00,0x00);
fnPR1(LC_GRH_WID,0x14,0x00);
fnPR12(LC_CUR_SHP | 0x01);
fnPR12(LC_MOD_OR);
fnPR12(LC_DIS_SW | 0x08);
return 0;
}
void main(void)
{
Key_No = 0;
CCW_Key_Press = 0;
CW_Key_Press = 0;
Timer0_Delay(250);
IE = 0x05;
EA=0;
AUTO_RUN = 1;
fnLCMInit();
do{
Next_SW();
switch(Key_No)
{
case 0:fnLCMInit();
break;
case 1:
Clear();
break;
case 2:
Fill_Screen();
break;
case 3:
Display_Chess(0xff,0x00);
break;
case 4:
Display_Chess(0x00,0xff);
break;
case 5:
Display_Chess(0xAA,0x55);
break;
case 6:
Display_Chess(0x55,0xAA);
break;
case 7:
Display_Chess(0xAA,0xAA);
break;
case 8:
Display_Chess(0x55,0x55);
break;
case 9:
Display_Chess_Fill();
break;
case 10:
Display_Bmp(Bmp_1);
break;
case 11:
Display_Same_character(0x31,1,(LCM_Width/8)*(LCM_Height/8));
break;
case 12:
Display_Lib();
break;
case 13:
break;
case 14:
break;
default: break;
}
}while(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -