⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demo.lst

📁 320x240驱动程序(网上搜集资料).rar
💻 LST
📖 第 1 页 / 共 2 页
字号:
 161   1              LCD_CmdWrite(0xb0);
 162   1              LCD_PrintStr(sRAiO6a, 159);
 163   1              
 164   1              Delay100ms(2);
 165   1              LCD_LineDist_Adjust(0);
 166   1              LCD_GotoXY(20,0);
 167   1              LCD_CmdWrite(0xb0);
 168   1              LCD_PrintStr(sRAiO6b, 231);
 169   1      }
 170          
 171          void Display_Touch(void)
 172          {
 173   1              uchar Debounce_count = 0;
 174   1              uchar temp2,X1,Y1,X2,Y2;
 175   1              int Timer_count = 0;
 176   1      
 177   1              LCD_LineDist_Adjust(0);
 178   1              LCD_Rotate90_Disable();
 179   1              COM_DIR_0_239();
C51 COMPILER V7.50   DEMO                                                                  01/08/2009 15:49:22 PAGE 4   

 180   1              LCD_FontSize(5);
 181   1      
 182   1              LCD_Text();
 183   1              LCD_GotoXY(4,12);
 184   1              LCD_CmdWrite(0xb0);
 185   1              LCD_PrintStr(sRAiO7a, 16);
 186   1              LCD_GotoXY(4,45);
 187   1              LCD_CmdWrite(0xb0);
 188   1              LCD_PrintStr(sRAiO7b, 16);
 189   1              LCD_FontSize(0);
 190   1      
 191   1              LCD_GotoXY(0,220);
 192   1              LCD_CmdWrite(0xb0);
 193   1              LCD_PrintStr(sRAiO8, cXSize);
 194   1      
 195   1              Access_Page1();
 196   1              Only_Show_Page1();
 197   1      
 198   1              LCD_CmdWrite(0xC0);                                                             // Enable Touch Panel Function
 199   1              LCD_DataWrite(0xC4);
 200   1      
 201   1              while(1)
 202   1              {
 203   2                      Debounce_count = 0;                                                     // initial Debounce counter
 204   2      
 205   2                      LCD_CmdWrite(0x0f);                                                     // Clear int
 206   2                      LCD_DataWrite(0x00);
 207   2                      Delay1ms(10);
 208   2      
 209   2                      LCD_CmdWrite(0x0f);     
 210   2                      temp2 = LCD_DataRead();
 211   2      
 212   2                      if((temp2 & 0x01) == 0x01)                      //Select Auto mode      
 213   2                      {
 214   3                              X1 = ADC_X1();
 215   3                              Y1 = ADC_Y1();
 216   3                              Delay1ms(2);
 217   3      
 218   3                              //===================================================
 219   3                              // Debounce The Touch State
 220   3                              //===================================================
 221   3                              if((X1 > 0x18)&&(X1 < 0xF0)&&(Y1 > 0x1B)&&(Y1 < 0xEA))
 222   3                              {
 223   4                                      do
 224   4                                      {
 225   5                                      X2 = ADC_X1();                                                          // Get coordinate value X2 and Y2
 226   5                                              Y2 = ADC_Y1();
 227   5                                              Delay1ms(2);
 228   5      
 229   5                                              if((X2 == X1)&&(Y2 == Y1))              // Coordinate value are same as last time?
 230   5                                              {
 231   6                                                      X1 = X2;                                                                                // if sames then update X1 and Y1
 232   6                                                      Y1 = Y2;
 233   6                                              }
 234   5      
 235   5                                              Debounce_count++;                                                       // Comapre counter increase 1
 236   5      
 237   5                                              if(Debounce_count == 2)                         // Compare the coordinate value twice?
 238   5                                              {
 239   6                                                      if((X1 != 0)||(Y1 != 0))                // if X1 = Y1 = 0, Do not show coordinate value
 240   6                                                      {
 241   7                                                              LCD_Text();
C51 COMPILER V7.50   DEMO                                                                  01/08/2009 15:49:22 PAGE 5   

 242   7                                      
 243   7                                                              LCD_GotoXY(13, 112);
 244   7                                                              LCD_CmdWrite(0xb0);
 245   7                                                              LCD_ShowStr("X = ",1);
 246   7                                                              LCD_GotoXY(17, 112);
 247   7                                                              LCD_CmdWrite(0xb0);
 248   7                                                              Print_Hex(X1);                                          // Show X-coordinate
 249   7      
 250   7                                                              LCD_GotoXY(21, 112);
 251   7                                                              LCD_CmdWrite(0xb0);
 252   7                                                              LCD_ShowStr("Y = ",1);
 253   7                                                              LCD_GotoXY(25, 112);
 254   7                                                              LCD_CmdWrite(0xb0);
 255   7                                                              Print_Hex(Y1);                                          // Show Y-coordinate
 256   7                                                              Timer_count = 0;
 257   7                                                      }
 258   6              
 259   6                                                      Debounce_count = 0;                                     // initial debounce counter
 260   6      
 261   6                                                      LCD_CmdWrite(0x0f);                                     // Clear TP status
 262   6                                                      LCD_DataWrite(0x00);
 263   6                                                      break;                                                                                  // Exit do-while 
 264   6                                              }
 265   5      
 266   5                                              LCD_CmdWrite(0x0f);                                             // Clear TP status
 267   5                                              LCD_DataWrite(0x00);
 268   5                                              Delay1ms(10);
 269   5      
 270   5                                              LCD_CmdWrite(0x0f);                                             // Check the TP Status
 271   5                                              temp2 = LCD_DataRead();                 
 272   5      
 273   5                                      }while((temp2 & 0x01) == 0x01);         // Exit this function for no touch
 274   4      
 275   4                              }       // The end of if((X1 > 0x18)&&(X1 < 0xF0)&&(Y1 > 0x1B)&&(Y1 < 0xEA))
 276   3      
 277   3                              LCD_CmdWrite(0x0f);                                                             // Clear TP status
 278   3                              LCD_DataWrite(0x00);
 279   3                      }
 280   2      
 281   2                      else    // When release a nonsense touch for 20 seconds, exit touch-panel mode
 282   2                      {
 283   3                              Delay1ms(1);
 284   3                              Timer_count++;
 285   3                              if(Timer_count == 350)
 286   3                              {
 287   4                                      Timer_count = 0;
 288   4                                      break;
 289   4                              }
 290   3                      }
 291   2              }
 292   1      }
 293          
 294          uchar ADC_X1(void)
 295          {
 296   1              uchar temp;
 297   1              LCD_CmdWrite(TPXR);
 298   1              temp=LCD_DataRead();
 299   1              Delay1ms(10);
 300   1              return temp;
 301   1      }
 302          
 303          uchar ADC_Y1(void)
C51 COMPILER V7.50   DEMO                                                                  01/08/2009 15:49:22 PAGE 6   

 304          {
 305   1              uchar temp;
 306   1              
 307   1              LCD_CmdWrite(TPYR);
 308   1              temp=LCD_DataRead();
 309   1              Delay1ms(10);   
 310   1              return temp;
 311   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    930    ----
   CONSTANT SIZE    =  10224    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      14
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -