📄 demo.c
字号:
else
temp = 255;
LCD_CmdWrite(BTMR);
LCD_DataWrite(temp);
break;
case 0x80:
LCD_Rotate90_Disable();
COM_DIR_0_239();
LCD_CmdWrite(BTMR);
LCD_DataWrite(0x80);
LCD_AlignOff();
LCD_NoCur();
LCD_NoCurBlk();
Main_Function();
break;
}
}
#ifdef Auto_Run
Delay1ms(1);
Count++;
if(Count == 25000)
{
Count = 0;
AutoRun_Function();
}
#endif
}
}
void Two_Layer_Function(void)
{
int i, Count = 0;
// uchar temp;
LCD_Clear();
Two_Layer_OR();
Show_Two_Layer();
Access_Page1();
LCD_Text();
LCD_LineDist_Adjust(8);
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(i=0;i<105;i++)
{
LCD_DataWrite(sRAiO1[i]);
Delay2us(50);
}
LCD_GotoXY(14,70);
LCD_CmdWrite(0xb0);
for(i=0;i<10;i++)
{
LCD_DataWrite(sRAiO3[i]);
Delay2us(50);
}
LCD_GotoXY(14,170);
LCD_CmdWrite(0xb0);
for(i=0;i<10;i++)
{
LCD_DataWrite(sRAiO4[i]);
Delay2us(50);
}
LCD_Graphic();
Access_Page2();
LCD_GotoXY(0,120);
LCD_CmdWrite(0xb0);
for(i=0;i<1760;i++)
LCD_DataWrite(0xff);
while(1)
{
if(Get_Key())
{
Clr_KeyScan_INT_Flag();
Count = 0;
LCD_CmdWrite(KSDR0);
Key_Code1 = LCD_DataRead();
Delay2us(50);
switch(Key_Code1)
{
case 0x01: // OR
LCD_Clear();
Two_Layer_OR();
Access_Page1();
LCD_Text();
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(i=0;i<105;i++)
{
LCD_DataWrite(sRAiO1[i]);
Delay2us(50);
}
LCD_GotoXY(11,70);
LCD_CmdWrite(0xb0);
for(i=0;i<18;i++)
{
LCD_DataWrite(sRAiO5[i]); // show "OR - Composition"
Delay2us(50);
}
Access_Page2();
LCD_Graphic();
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(i=0;i<1760;i++)
LCD_DataWrite(0xff);
break;
case 0x11:
LCD_Clear();
Two_Layer_XOR();
Access_Page1();
LCD_Text();
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(i=0;i<105;i++)
{
LCD_DataWrite(sRAiO1[i]);
Delay2us(50);
}
LCD_GotoXY(11,70);
LCD_CmdWrite(0xb0);
for(i=0;i<18;i++)
{
LCD_DataWrite(sRAiO6[i]); // show "XOR - Composition"
Delay2us(50);
}
Access_Page2();
LCD_Graphic();
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(i=0;i<1760;i++)
LCD_DataWrite(0xff);
break;
case 0x21:
LCD_Clear();
Two_Layer_NOR();
Access_Page1();
LCD_Text();
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(i=0;i<105;i++)
{
LCD_DataWrite(sRAiO1[i]);
Delay2us(50);
}
LCD_GotoXY(11,70);
LCD_CmdWrite(0xb0);
for(i=0;i<18;i++)
{
LCD_DataWrite(sRAiO7[i]); // show "NOR - Composition"
Delay2us(50);
}
Access_Page2();
LCD_Graphic();
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(i=0;i<1760;i++)
LCD_DataWrite(0xff);
break;
case 0x31:
LCD_Clear();
Two_Layer_AND();
Access_Page1();
LCD_Text();
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(i=0;i<105;i++)
{
LCD_DataWrite(sRAiO1[i]);
Delay2us(50);
}
LCD_GotoXY(11,70);
LCD_CmdWrite(0xb0);
for(i=0;i<18;i++)
{
LCD_DataWrite(sRAiO8[i]); // show "AND - Composition"
Delay2us(50);
}
Access_Page2();
LCD_Graphic();
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(i=0;i<1760;i++)
LCD_DataWrite(0xff);
LCD_GotoXY(0,70);
LCD_CmdWrite(0xb0);
for(i=0;i<640;i++)
{
LCD_DataWrite(0xff);
Delay2us(50);
}
break;
case 0x80:
Access_Page1();
Only_Show_Page1();
LCD_CmdWrite(BTMR);
LCD_DataWrite(0x20);
LCD_NoGInv();
LCD_NoBlk();
Main_Function();
break;
}
Clr_KeyScan_INT_Flag();
}
#ifdef Auto_Run
Delay1ms(1);
Count++;
if(Count == 25000)
{
Count = 0;
AutoRun_Function();
}
#endif
}
}
void Scrolling_Function(void)
{
uchar i,j,temp;
int k,Count = 0;
LCD_Clear();
Scroll_Disable();
Set_Scroll_Window_Size(4,35,24,215);
LCD_Text();
LCD_LineDist_Adjust(8);
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(j=0;j<2;j++)
{
for(i=0;i<181;i++)
{
LCD_DataWrite(sRAiO2[i]);
Delay2us(50);
}
}
while(1)
{
if(Get_Key())
{
Clr_KeyScan_INT_Flag();
Count = 0;
LCD_CmdWrite(KSDR0);
Key_Code1 = LCD_DataRead();
Delay2us(50);
switch(Key_Code1)
{
case 0x01:
LCD_CmdWrite(ADSR);
LCD_DataWrite(0x01);
break;
case 0x11:
LCD_CmdWrite(ADSR);
LCD_DataWrite(0x03);
break;
case 0x21:
LCD_CmdWrite(ADSR);
LCD_DataWrite(0x05);
break;
case 0x31:
LCD_CmdWrite(ADSR);
LCD_DataWrite(0x07);
break;
case 0x02:
#ifdef Show_Picture
LCD_Clear();
LCD_Graphic();
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(k=0;k<9600;k++)
LCD_DataWrite(gImage_1[k]);
#endif
break;
case 0x12:
LCD_CmdWrite(ADSR);
temp = LCD_DataRead();
temp &= 0xfe;
LCD_CmdWrite(ADSR);
LCD_DataWrite(temp);
break;
case 0x22:
LCD_CmdWrite(ADSR);
temp = LCD_DataRead();
temp ^= cSetb7;
LCD_CmdWrite(ADSR);
LCD_DataWrite(temp);
break;
case 0x03:
LCD_CmdWrite(BTMR);
temp = LCD_DataRead();
if(temp > 4)
temp = temp - 5;
else
temp = 0;
LCD_CmdWrite(BTMR);
LCD_DataWrite(temp);
break;
case 0x13:
LCD_CmdWrite(BTMR);
temp = LCD_DataRead();
if(temp < 251)
temp = temp + 5;
else
temp = 255;
LCD_CmdWrite(BTMR);
LCD_DataWrite(temp);
break;
case 0x80:
Scroll_Disable();
LCD_CmdWrite(BTMR);
LCD_DataWrite(0x80);
Main_Function();
break;
}
Clr_KeyScan_INT_Flag();
}
#ifdef Auto_Run
Delay1ms(1);
Count++;
if(Count == 25000)
{
Count = 0;
AutoRun_Function();
}
#endif
}
}
void Disp_Pic_Function(void)
{
uchar temp;
int i, Count = 0;
LCD_Clear();
Access_Page1();
Only_Show_Page1();
LCD_Graphic();
#ifdef Show_Picture
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(i=0;i<9600;i++)
LCD_DataWrite(gImage_1[i]);
#endif
while(1)
{
if(Get_Key())
{
Clr_KeyScan_INT_Flag();
Count = 0;
LCD_CmdWrite(KSDR0);
Key_Code1 = LCD_DataRead();
Delay2us(50);
switch(Key_Code1)
{
case 0x01:
#ifdef Show_Picture
LCD_Clear();
LCD_Graphic();
Gray_Mode();
LCD_CmdWrite(ITCR);
LCD_DataWrite(0x9f);
LCD_GotoXY(0,0);
LCD_CmdWrite(0xB0);
for(i=0;i<19200;i++)
{
LCD_DataWrite(~gImage_Control16[i]);
}
#endif
break;
case 0x11:
#ifdef Show_Picture
LCD_Clear();
Access_Page1();
Only_Show_Page1();
LCD_Graphic();
LCD_CmdWrite(ITCR);
LCD_DataWrite(0xff);
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(i=0;i<9600;i++)
LCD_DataWrite(gImage_1[i]);
#endif
break;
case 0x21:
LCD_CmdWrite(WLCR);
temp = LCD_DataRead();
temp ^= cSetb0;
LCD_CmdWrite(WLCR);
LCD_DataWrite(temp);
break;
case 0x31:
LCD_CmdWrite(WLCR);
temp = LCD_DataRead();
temp ^= cSetb1;
LCD_CmdWrite(WLCR);
LCD_DataWrite(temp);
break;
case 0x03:
LCD_CmdWrite(BTMR);
temp = LCD_DataRead();
if(temp > 4)
temp = temp - 5;
else
temp = 0;
LCD_CmdWrite(BTMR);
LCD_DataWrite(temp);
break;
case 0x13:
LCD_CmdWrite(BTMR);
temp = LCD_DataRead();
if(temp < 251)
temp = temp + 5;
else
temp = 255;
LCD_CmdWrite(BTMR);
LCD_DataWrite(temp);
break;
case 0x80:
LCD_CmdWrite(BTMR);
LCD_DataWrite(0x20);
LCD_CmdWrite(ITCR);
LCD_DataWrite(0xff);
LCD_NoGInv();
LCD_NoBlk();
Access_Page1();
Only_Show_Page1();
Main_Function();
break;
}
}
#ifdef Auto_Run
Delay1ms(1);
Count++;
if(Count == 25000)
{
Count = 0;
AutoRun_Function();
}
#endif
}
}
void Sleep_Function(void)
{
uchar i;
uchar Sleep_Flag = 0;
int Count = 0;
Enable_KeyScan_WakeUp();
LCD_Clear();
LCD_Text();
LCD_GotoXY(0,0);
LCD_CmdWrite(0xb0);
for(i=0;i<159;i++)
{
LCD_DataWrite(sRAiO1[i]);
Delay2us(50);
}
while(1)
{
if(Get_Key())
{
Clr_KeyScan_INT_Flag();
Count = 0;
LCD_CmdWrite(KSDR0);
Key_Code1 = LCD_DataRead();
Delay2us(50);
if(Sleep_Flag == 1)
{
Key_Code1 = 0xFF;
Sleep_Flag = 0;
Delay100ms(1);
}
switch(Key_Code1)
{
case 0x01:
Sleep_Flag = 1;
Delay100ms(5);
LCD_SleepMode();
break;
case 0x80:
Main_Function();
break;
}
}
#ifdef Auto_Run
Delay1ms(1);
Count++;
if(Count == 25000)
{
Count = 0;
AutoRun_Function();
}
#endif
}
}
//===========================================================
//
//===========================================================
void Touch_Panel_Function(void)
{
#ifdef Touch_Panel_Func_Enable
int i,j;
LCD_Clear();
Access_Page1();
Only_Show_Page1();
#ifdef TP_Application_1
for(i=0;i<210;i++)
{
LCD_GotoXY(7,20+i);
LCD_CmdWrite(0xb0);
for(j=0;j<26;j++)
LCD_DataWrite(gImage_TP_Button_pic[j+i*26]); //5460 bytes
}
#endif
#ifdef KeyPress_to_Exit_Touch_Mode
while(1)
{
if(Get_Key())
{
Clr_KeyScan_INT_Flag();
LCD_CmdWrite(KSDR0);
Key_Code1 = LCD_DataRead();
Delay2us(50);
switch(Key_Code1)
{
case 0x80:
Main_Function();
break;
}
}
}
#endif
// while(1);
Test_Touch();
#endif
}
void AutoRun_Function(void)
{
uchar temp, State = 0;
int i;
LCD_LineDist_Adjust(0);
while(1)
{
switch(State)
{
case 0: // Rotate
Check_Button_Press();
LCD_Clear();
Access_Page1();
Only_Show_Page1();
LCD_Text();
LCD_Rotate90_Disable();
LCD_FontSize(5);
LCD_GotoXY(5,104);
LCD_CmdWrite(0xb0);
for(i=0;i<15;i++)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -