?? demo.c
字號:
/*******************************************************************************
*
* Filename: Demo.c
*
* Author: Duke Chang
* Company: RAiO Technology Inc.
* Case: 320x240
* Device: MXIC MX10E8050IQC at 18.432MHz
* Date: 2005/10/1
* Modifier: Duke Chang
* Modify Date: 2005/10/13
* Visions: 1.0
* Compiled Using Keil C v7.50
*
********************************************************************************
*
* Function
*
********************************************************************************
*
* Pin assignemt:
* P0.0 : D0
* P0.1 : D1
* P0.2 : D2
* P0.3 : D3
* P0.4 : D4
* P0.5 : D5
* P0.6 : D6
* P0.7 : D7
*
* P2.0 : RSTZ
*
* P3.0 : X
* P3.1 : X
* P3.2 : X
* P3.3 : RS
* P3.4 : CSZ
* P3.5 : X
* P3.6 : WRZ
* P3.7 : RDZ
*
*******************************************************************************/
#include "Demo.h"
/******************************************************************************/
/*Main program area */
/******************************************************************************/
void main(void)
{
uchar state;
P0 = 0xff;
P1 = 0xff;
P2 = 0xff;
P3 = 0xff;
AUXR = B0000_0011; //Enable MOVX for external interface
LCD_Reset();
LCD_Initial();
state = 0;
while(1)
{
switch(state)
{
case 0:
Test_Font();
break;
case 1:
// Test_Pattern();
break;
case 2:
Test_Touch();
break;
}
state++;
if(state==3) state=0;
}
}
/******************************************************************************/
/*Sub program area */
/******************************************************************************/
//==============================================================================
//Subroutine: Test_Pattern
//Function:
//==============================================================================
void Test_Pattern(void)
{
uchar x, y;
uchar pat, temp, count;
LCD_ON();
// LCD_Clear();
LCD_Graphic();
pat = 0;
count = 0;
while(1)
{
switch(pat)
{
case 0:
temp = 0xff;
break;
case 1:
temp = 0x00;
break;
case 2:
temp = 0x55;
break;
case 3:
temp = 0xaa;
break;
case 4:
case 8:
temp = 0xcc;
break;
case 5:
temp = 0x33;
break;
case 6:
case 9:
temp = 0xF0;
break;
case 7:
temp = 0x0F;
break;
}
LCD_GotoXY(0, 0);
for(y=0 ; y<cYSize ; y++)
{
for(x=0 ; x<cXSize ; x++)
{ // Delay100us(1);
LCD_DataWrite(temp);
}
// Delay100us(1);
count++;
if((pat==8)&&(count==2))
{
temp = ~temp;
count=0;
}
else if((pat==9)&&(count==4))
{
temp = ~temp;
count=0;
}
}
Delay100ms(20);
pat++;
if(pat == 10) break;
}
}
//==============================================================================
//Subroutine: Test Display/Inverse/Blink/Cursor
//Function:
//==============================================================================
void Test_Touch(void)
{
uchar temp, X1, X2, Y1, Y2;
ADC_On();
LCD_GotoXY(0, 210);
for(temp=0 ; temp<22 ; temp++)
{ LCD_DataWrite(sRAiO5[temp]);
}
while(1)
{
temp = ADC_Touch();
if(temp==0x01)
{
X1 = ADC_X();
Y1 = ADC_Y();
Delay1ms(2);
temp = ADC_Touch();
if(temp==0x01)
{
X2 = ADC_X();
Y2 = ADC_Y();
Delay1ms(2);
LCD_GotoXY(0, 210);
if((X1==X2) && (Y1==Y2))
{
LCD_Bold();
for(temp=0 ; temp<11 ; temp++)
{ LCD_DataWrite(sRAiO7[temp]);
}
Delay10ms(1);
LCD_GotoXY(13, 210);
Print_Hex(X1);
LCD_GotoXY(21, 210);
Print_Hex(Y1);
LCD_NoBold();
}
}
}
else
{
LCD_GotoXY(0, 210);
for(temp=0 ; temp<11 ; temp++)
{ LCD_DataWrite(sRAiO6[temp]);
}
}
}
}
//==============================================================================
//Subroutine: Test_Font, 8x18, 8x16m 16x16, Bold
//Function:
//==============================================================================
void Test_Font(void)
{
uchar temp;
uchar pat;
LCD_ON();
pat = 0;
LCD_Clear();
LCD_Text();
LCD_AlignOff();
LCD_GotoXY(0, 0);
for(temp=0 ; temp<cXSize ; temp++)
{ LCD_DataWrite(sRAiO1[temp]);
}
Delay10ms(2);
// LCD_GotoXY(0, 0);
for(temp=0 ; temp<cXSize ; temp++)
{ LCD_DataWrite(sRAiO2[temp]);
}
Delay10ms(2);
LCD_Inv();
for(temp=0 ; temp<cXSize ; temp++)
{
LCD_DataWrite(sRAiO3[temp]);
}
Delay10ms(2);
LCD_NoInv();
LCD_GotoXY(10, 75);
LCD_FontSize(0x05);
for(temp=0 ; temp<11 ; temp++)
{ LCD_DataWrite(sRAiO4[temp]);
}
Delay10ms(2);
LCD_FontSize(0x00);
LCD_GotoXY(0, 120);
for(temp=0x30 ; temp<=0x7F ; temp++)
{
LCD_DataWrite(temp);
}
Delay10ms(2);
LCD_GotoXY(0, 160);
LCD_Bold();
for(temp=0x30 ; temp<=0x7F ; temp++)
{
LCD_DataWrite(temp);
}
LCD_NoBold();
Delay100ms(10);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -