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

📄 access.lst

📁 液晶显示器程序代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
              #endif
 277   1      }
 278          
 279          void I2CSendStop(void)
 280          {
 281   1      #if(MCU_TYPE == MCU_WINBOND)
 282   1          bIIC_SDA    = 0; 
 283   1          BitDly();
 284   1      
 285   1          bIIC_SCL    = 1;
 286   1          BitDly();
 287   1      
 288   1          bIIC_SDA    = 1;
 289   1          BitDly();
 290   1      #else
                  MCU_WriteI2cSda(_LOW); 
                  BitDly();
                  MCU_WriteI2cScl(_HIGH);
                  BitDly();
                  MCU_WriteI2cSda(_HIGH);
C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 6   

                  BitDly();
              #endif
 298   1      }
 299          
 300          unsigned char RTDGetByte(void) 
 301          {
 302   1      
 303   1      #if(PARALLEL_PORT)
              
              #if(1)
                 bRTD_SCLK = 1;
                 bRTD_SCLK = 0;
                 r0        = bRTD_SDIO_0;
                 r1        = bRTD_SDIO_1;
                 r2        = bRTD_SDIO_2;
                 r3        = bRTD_SDIO_3;
              
                 bRTD_SCLK = 1;
                 bRTD_SCLK = 0;
                 r4        = bRTD_SDIO_0;
                 r5        = bRTD_SDIO_1;
                 r6        = bRTD_SDIO_2;
                 r7        = bRTD_SDIO_3;
              
                 bRTD_SCLK   = 1;
              #else
              
                 bRTD_SCLK = 1;
                 bRTD_SCLK = 0;
              
                 Reg = P0 & 0x0f;
              
                 bRTD_SCLK = 1;
                 bRTD_SCLK = 0;
              
                 Reg = Reg | ((P0 & 0x0f) << 4);
              
                 bRTD_SCLK   = 1;
              
              #endif
              
              #else //serial port
 338   1          bRTD_SCLK   = 1;
 339   1          bRTD_SCLK   = 0;
 340   1          r0          = bRTD_SDIO_0;
 341   1      
 342   1          bRTD_SCLK   = 1;
 343   1          bRTD_SCLK   = 0;
 344   1          r1          = bRTD_SDIO_0;
 345   1      
 346   1          bRTD_SCLK   = 1;
 347   1          bRTD_SCLK   = 0;
 348   1          r2          = bRTD_SDIO_0;
 349   1      
 350   1          bRTD_SCLK   = 1;
 351   1          bRTD_SCLK   = 0;
 352   1          r3          = bRTD_SDIO_0;
 353   1      
 354   1          bRTD_SCLK   = 1;
 355   1          bRTD_SCLK   = 0;
 356   1          r4          = bRTD_SDIO_0;
 357   1      
C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 7   

 358   1          bRTD_SCLK   = 1;
 359   1          bRTD_SCLK   = 0;
 360   1          r5          = bRTD_SDIO_0;
 361   1      
 362   1          bRTD_SCLK   = 1;
 363   1          bRTD_SCLK   = 0;
 364   1          r6          = bRTD_SDIO_0;
 365   1      
 366   1          bRTD_SCLK   = 1;
 367   1          bRTD_SCLK   = 0;
 368   1          r7          = bRTD_SDIO_0;
 369   1      
 370   1          bRTD_SCLK   = 1;
 371   1      
 372   1      #endif
 373   1      
 374   1      
 375   1          return Reg;
 376   1      }
 377          
 378          void RTDSendByte(unsigned char send)
 379          {
 380   1      
 381   1      
 382   1      #if(PARALLEL_PORT)
              
              #if(1)
                  bRTD_SDIO_0 = (bit)(send & 0x01);
                      bRTD_SDIO_1 = (bit)(send & 0x02);
                      bRTD_SDIO_2 = (bit)(send & 0x04);
                      bRTD_SDIO_3 = (bit)(send & 0x08);
                      bRTD_SCLK   = 1;
                  bRTD_SCLK   = 0;
              
                      bRTD_SDIO_0 = (bit)(send & 0x10);
                      bRTD_SDIO_1 = (bit)(send & 0x20);
                      bRTD_SDIO_2 = (bit)(send & 0x40);
                      bRTD_SDIO_3 = (bit)(send & 0x80);
                      bRTD_SCLK   = 1;
                  bRTD_SCLK   = 0;
              
                      bRTD_SDIO_0 = 1;
                      bRTD_SDIO_1 = 1;
                      bRTD_SDIO_2 = 1;
                      bRTD_SDIO_3 = 1;
                      bRTD_SCLK   = 1;
              #else
                  unsigned char ucTemp;
              
                      ucTemp = P0 & 0xf0;
              
                  P0 = ucTemp | (send & 0x0f);
                  bRTD_SCLK   = 1;
                  bRTD_SCLK   = 0;
              
                  P0 = ucTemp | (send >> 4);
              
                      bRTD_SCLK   = 1;
                  bRTD_SCLK   = 0;
              
                  P0 = ucTemp | 0x0f;
                      bRTD_SCLK   = 1;
C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 8   

              
              #endif
              
              #else //serial port
 424   1          bRTD_SDIO_0 = (bit)(send & 0x01);
 425   1          bRTD_SCLK   = 1;
 426   1          bRTD_SCLK   = 0;
 427   1      
 428   1          bRTD_SDIO_0 = (bit)(send & 0x02);
 429   1          bRTD_SCLK   = 1;
 430   1          bRTD_SCLK   = 0;
 431   1      
 432   1          bRTD_SDIO_0 = (bit)(send & 0x04);
 433   1          bRTD_SCLK   = 1;
 434   1          bRTD_SCLK   = 0;
 435   1      
 436   1          bRTD_SDIO_0 = (bit)(send & 0x08);
 437   1          bRTD_SCLK   = 1;
 438   1          bRTD_SCLK   = 0;
 439   1      
 440   1          bRTD_SDIO_0 = (bit)(send & 0x10);
 441   1          bRTD_SCLK   = 1;
 442   1          bRTD_SCLK   = 0;
 443   1      
 444   1          bRTD_SDIO_0 = (bit)(send & 0x20);
 445   1          bRTD_SCLK   = 1;
 446   1          bRTD_SCLK   = 0;
 447   1      
 448   1          bRTD_SDIO_0 = (bit)(send & 0x40);
 449   1          bRTD_SCLK   = 1;
 450   1          bRTD_SCLK   = 0;
 451   1      
 452   1          bRTD_SDIO_0 = (bit)(send & 0x80);
 453   1          bRTD_SCLK   = 1;
 454   1          bRTD_SCLK   = 0;
 455   1      
 456   1          bRTD_SDIO_0 = 1;
 457   1          bRTD_SCLK   = 1;
 458   1      
 459   1      #endif
 460   1      
 461   1      
 462   1      }
 463          
 464          void RTDSendAddr(unsigned char addr, unsigned char rd, unsigned char inc)   // rd   : 0 - Write, 1 - Read
 465          {
 466   1      
 467   1      #if(PARALLEL_PORT)
              
                  RTDSendByte(addr);
              
                      bRTD_SDIO_0 = (bit)(rd & 0x01);
                      bRTD_SDIO_1 = (bit)(inc & 0x01);
                      
                      bRTD_SCLK = 0;
              
                      bRTD_SDIO_0 = 1;
                      bRTD_SDIO_1 = 1;
                      bRTD_SCLK = 1;
              #else // serial port
 480   1          RTDSendByte(addr);
 481   1      
C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 9   

 482   1          bRTD_SDIO_0 = 1;
 483   1          bRTD_SCLK   = 1;        
 484   1          bRTD_SDIO_0 = (bit)(rd & 0x01); 
 485   1          bRTD_SCLK   = 1;
 486   1          bRTD_SCLK   = 0;
 487   1          bRTD_SDIO_0 = (bit)(inc & 0x01); 
 488   1          bRTD_SCLK   = 1;
 489   1          bRTD_SCLK   = 0;
 490   1          bRTD_SDIO_0 = 1;
 491   1      #endif
 492   1      
 493   1      
 494   1      }
 495          
 496          void RTDSendStop(void)
 497          {
 498   1      
 499   1              bRTD_SCLK   = 0;
 500   1              bRTD_SCLK   = 1; 
 501   1              bRTD_SCSB   = 1;
 502   1      
 503   1      }
 504          
 505          void RTDRead(unsigned char index, unsigned char count, unsigned char inc)
 506          {
 507   1          if (count)
 508   1          {
 509   2              bRTD_SCSB   = 0;
 510   2      
 511   2              RTDSendAddr(index, 1, inc);
 512   2      
 513   2              index   = 0;
 514   2              do
 515   2              {
 516   3                  Data[index++]   = RTDGetByte();
 517   3              }
 518   2              while (--count);
 519   2      
 520   2                      RTDSendStop();
 521   2      
 522   2          }
 523   1      }
 524          
 525          void RTDWrite(unsigned char data *array)
 526          {
 527   1      
 528   1          unsigned char   len, m;
 529   1      
 530   1          do
 531   1          {
 532   2              if (0 == (array[0] & 0xfc))     return;
 533   2      
 534   2              len     = array[0] - 3;
 535   2              array   = array + 1;
 536   2              bRTD_SCSB   = 0;
 537   2      
 538   2      
 539   2              if (BURST == array[0])
 540   2              {
 541   3                  RTDSendAddr(array[1], 0, N_INC);
 542   3      
 543   3                  array   = array + 2;
C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 10  

 544   3                  m       = array[0];
 545   3      
 546   3                  do
 547   3                  {
 548   4                      RTDSendByte(m);
 549   4                  }
 550   3                  while (--len);
 551   3      
 552   3                  array   = array + 1;
 553   3              }
 554   2              else
 555   2              {
 556   3                  RTDSendAddr(array[1], 0, array[0]);
 557   3      
 558   3                  array   = array + 2;
 559   3                  do
 560   3                  {
 561   4                      RTDSendByte(*array++);
 562   4                  }
 563   3                  while (--len);
 564   3              }
 565   2                      RTDSendStop();

⌨️ 快捷键说明

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