C51 COMPILER V9.01   MAIN                                                                  07/18/2014 12:11:01 PAGE 1   


C51 COMPILER V9.01, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c LARGE BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <reg51.h>
   2          #include <intrins.h>
   3          #include <sys\sys.h>
   4          #include <lcd\lcd.h>
   5          #include <font\font.h>
   6          #include <touch\touch.h>
   7          /* 
   8          代码测试环境:单片机STC12LE5A60S2,晶振33M  单片机工作电压3.3V
   9          程序默认IO连接方式：
  10          sbit LCD_CS     =P0^0;     //片选       
  11          sbit LCD_DC     =P0^2;    //数据/命令切换
  12          sbit LCD_SDI    =P1^5;    //数据
  13          sbit LCD_SCK    =P1^7;    //时钟
  14          sbit LCD_REST   =P0^1;    //复位  
  15          触摸功能连接方式：(不使用触摸可不连接)
  16          T_CLK-P1^7;  T_CS-P1^4;  T_DIN-P3^0;  T_OUT-P3^1;  T_IRQ-P3^4;
  17          */              
  18          sbit key1=P3^2;
  19          sbit key2=P3^3;
  20          sbit key3=P3^4;
  21          u8 ref=0;//刷新显示
  22          
  23          u8 jiance() //检测触摸和按键
  24          {
  25   1              if (tpstate()==0) //如果触摸按下，则进入绘图程序
  26   1               {
  27   2                      LCD_Clear(WHITE); //清屏
  28   2                      BACK_COLOR=WHITE;
  29   2                      POINT_COLOR=RED;
  30   2                      point();
  31   2                      return 1;
  32   2               }      
  33   1              if(key1==0)     //如果按键1按下,进入校准程序 
  34   1                 {
  35   2                      Touch_Adjust();//校准
  36   2                      return 1;
  37   2                 }
  38   1               if(key2==0)    //三色刷屏
  39   1                 {
  40   2                       LCD_Clear(RED);
  41   2                       delayms(3000);
  42   2                       LCD_Clear(GREEN);
  43   2                       delayms(3000);
  44   2                       LCD_Clear(BLUE);
  45   2                       delayms(3000);
  46   2                       return 1;
  47   2                 }
  48   1                 return 0;
  49   1      }
  50          void xianshi()//显示信息
  51          {   
  52   1              u16 lx,ly;
  53   1              BACK_COLOR=WHITE;
  54   1              POINT_COLOR=RED;        
  55   1              showhanzi(10,0,0);  //晶
C51 COMPILER V9.01   MAIN                                                                  07/18/2014 12:11:01 PAGE 2   

  56   1              showhanzi(45,0,1);  //耀
  57   1          LCD_ShowString(10,35,"2.4 TFT SPI 240*320");
  58   1              LCD_ShowString(10,55,"LCD_W:"); LCD_ShowNum(70,55,LCD_W,3);
  59   1              LCD_ShowString(110,55,"LCD_H:");LCD_ShowNum(160,55,LCD_H,3);    
  60   1              lx=10;ly=75;                    
  61   1              LCD_ShowString(lx,ly,"VX:");lx+=40;LCD_ShowNum(lx,ly,vx,5);                                     
  62   1              lx+=60;
  63   1              LCD_ShowString(lx,ly,"Vy:");lx+=40;LCD_ShowNum(lx,ly,vy,5);                                     
  64   1              lx=10;ly=95; 
  65   1              LCD_ShowString(lx,ly,"CHX:");lx+=40;LCD_ShowNum(lx,ly,chx,5);                                   
  66   1              lx+=60; 
  67   1              LCD_ShowString(lx,ly,"CHY:");lx+=40;LCD_ShowNum(lx,ly,chy,5);
  68   1      }
  69          void showimage() //显示40*40图片
  70          {
  71   1              int i,j,k; 
  72   1              LCD_Clear(WHITE); //清屏  
  73   1              xianshi(); //显示信息
  74   1              for(k=3;k<8;k++)
  75   1              {
  76   2                      for(j=0;j<6;j++)
  77   2                      {       
  78   3                              Address_set(40*j,40*k,40*j+39,40*k+39);         //坐标设置
  79   3                          for(i=0;i<1600;i++)
  80   3                               {      
  81   4                                       if(jiance()) //检测触摸和按键
  82   4                                       {      
  83   5                                              ref=1;
  84   5                                              return; 
  85   5                                       }              
  86   4                                       LCD_WR_DATA8(image[i*2+1]);     
  87   4                                       LCD_WR_DATA8(image[i*2]);                              
  88   4                               }      
  89   3                       }
  90   2              }
  91   1              ref=0;                          
  92   1      }
  93          main()
  94          { 
  95   1              spistar()  ;//模拟SPI初始化
  96   1              Lcd_Init();   //tft初始化
  97   1              LCD_Clear(WHITE); //清屏
  98   1              BACK_COLOR=BLACK;;POINT_COLOR=WHITE; 
  99   1          showimage(); //显示40*40图片
 100   1      
 101   1              while(1)
 102   1              {
 103   2                  if(jiance()) //检测触摸和按键
 104   2                {     
 105   3                      showimage(); //显示40*40图片
 106   3                }
 107   2                if(ref){showimage();} //显示40*40图片
 108   2      
 109   2          }
 110   1      
 111   1      
 112   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    936    ----
   CONSTANT SIZE    =     52    ----
C51 COMPILER V9.01   MAIN                                                                  07/18/2014 12:11:01 PAGE 3   

   XDATA SIZE       =      1      10
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
