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

📄 bitek.lst

📁 Bitek 公司 bit1611b模拟屏驱动芯片外接MCU驱动DEMO源码
💻 LST
📖 第 1 页 / 共 3 页
字号:
 514   1      
 515   1      
 516   1          // If Extension = 1 !
 517   1          if (bSLA & 0x01)
 518   1          {
 519   2              // MSB Slave Address [14:7]
 520   2              BITEK_TxData(wREG >> 7);
 521   2              BITEK_GetACK();
 522   2          }
 523   1      
 524   1          // LSB Slave Address [6:0]
 525   1          BITEK_TxData(wREG << 1);
 526   1          BITEK_GetACK();
 527   1      
 528   1      
 529   1          /* --------------------------------
 530   1              Write Data
 531   1             -------------------------------- */
 532   1          BITEK_TxData(bDATA);
 533   1          BITEK_GetACK();
 534   1      
 535   1          BITEK_Stop();
 536   1      } /* BITEK_TxByte */
 537          #endif
 538          
 539          
 540          /* -------------------------------------------------------------------
 541              Name: BITEK_TxData -
 542              Purpose: To do BITEK parallel/serial conversion for transmission.
 543              Passed:
C51 COMPILER V7.50   BITEK                                                                 02/05/2007 16:33:24 PAGE 10  

 544              Returns: None.
 545              Notes:
 546             ------------------------------------------------------------------- */
 547          void BITEK_TxData (UB8 bData)
 548          {
 549   1          UB8     bMask;
 550   1      
 551   1          /* MSB is sent first */
 552   1          for (bMask = 0x80; bMask; bMask >>= 1)
 553   1          {
 554   2              BITEK_SET_SDAT(bData & bMask)
 555   2              LO_PULSE;
 556   2      
 557   2              BITEK_SET_SCLK(HIGH);
 558   2              HI_PULSE;
 559   2      
 560   2              BITEK_SET_SCLK(LOW);
 561   2              LO_PULSE;
 562   2          }
 563   1      } /* BITEK_TxData */
 564          
 565          
 566          #if (BITEK_TX_REPEAT)
 567          /* -------------------------------------------------------------------
 568              Name: BITEK_TxRepeat -
 569              Purpose: To transmit the same data to BiTEKbus slave device repeatly.
 570              Passed:
 571                  UB8  bSLA   = BiTEKbus slave address.
 572                  UW16 wREG   = BiTEKbus register address.
 573                  UB8  bCNT   = The number of data which will be transmitted
 574                      excluding slave and register address (bCNT: 1..255).
 575                  UB8  bDATA  = The repeated data.
 576              Returns: None.
 577              Notes:
 578             ------------------------------------------------------------------- */
 579          void BITEK_TxRepeat (
 580          UB8  bSLA,          /* BITEK slave address */
 581          UW16 wREG,          /* BITEK register address */
 582          UB8  bCNT,          /* The number of data which will be transmitted */
 583          UB8  bDATA          /* The repeated DATA */
 584          )
 585          {
 586   1          UB8 bIdx;
 587   1      
 588   1      
 589   1          if (bCNT == 0)
 590   1              return;
 591   1      
 592   1          BITEK_Start();
 593   1      
 594   1          BITEK_TxData(bSLA);
 595   1      
 596   1          BITEK_GetACK();
 597   1      
 598   1      
 599   1          // If Extension = 1 !
 600   1          if (bSLA & 0x01)
 601   1          {
 602   2              // MSB Slave Address [14:7]
 603   2              BITEK_TxData(wREG >> 7);
 604   2              BITEK_GetACK();
 605   2          }
C51 COMPILER V7.50   BITEK                                                                 02/05/2007 16:33:24 PAGE 11  

 606   1      
 607   1          // LSB Slave Address [6:0]
 608   1          BITEK_TxData(wREG << 1);
 609   1          BITEK_GetACK();
 610   1      
 611   1      
 612   1          /* --------------------------------
 613   1              Write Data
 614   1             -------------------------------- */
 615   1          for (bIdx = bCNT; bIdx; bIdx--)
 616   1          {
 617   2              BITEK_TxData(bDATA);           
 618   2              BITEK_GetACK();                
 619   2          } /* for */
 620   1      
 621   1      
 622   1          BITEK_Stop();
 623   1      } /* BITEK_TxRepeat */
 624          #endif // BITEK_TX_REPEAT
 625          
 626          
 627          #if (BITEK_TX_WORD)
              /* -------------------------------------------------------------------
                  Name: BITEK_TxWord -
                  Purpose: To transmit one word data to BiTEKbus slave device.
                  Passed:
                      UB8  bSLA   = BiTEKbus slave address.
                      UW16 wREG   = BiTEKbus register address.
                      UB8  bDATA  = One word transmitted data.
                  Returns: None.
                  Notes: To send LSB first and then MSB.
                 ------------------------------------------------------------------- */
              void BITEK_TxWord (
              UB8  bSLA,          /* BITEK slave address */
              UW16 wREG,          /* BITEK register address */
              UW16 wDATA          /* DATA item */
              )
              {
                  BITEK_Start();
              
                  BITEK_TxData(bSLA);
              
                  BITEK_GetACK();
              
              
                  // If Extension = 1 !
                  if (bSLA & 0x01)
                  {
                      // MSB Slave Address [14:7]
                      BITEK_TxData(wREG >> 7);
                      BITEK_GetACK();
                  }
              
                  // LSB Slave Address [6:0]
                  BITEK_TxData(wREG << 1);
                  BITEK_GetACK();
              
              
                  /* --------------------------------
                      Write Data
                     -------------------------------- */
                  // LSB Data
C51 COMPILER V7.50   BITEK                                                                 02/05/2007 16:33:24 PAGE 12  

                  BITEK_TxData(wDATA);            /* Low Byte */
                  BITEK_GetACK();
              
                  // MSB Data
                  BITEK_TxData(wDATA >> 8);       /* High Byte */
                  BITEK_GetACK();
              
                  BITEK_Stop();
              } /* BITEK_TxWord */
              #endif
 678          
 679          
 680          #else
              
              /* -------------------------------------------------------------------
                  Name: BITEK_Init -
                  Purpose: To initialize the BITEK module via I2C.
                  Passed: None.
                  Returns: None.
                  Notes:
                ------------------------------------------------------------------- */
              void BITEK_Init (void)
              {
              } /* BITEK_Init */
              
              
              /* -------------------------------------------------------------------
                  Name: BITEK_TxRepeat -
                  Purpose: To transmit the same data to BiTEKbus slave device repeatly via I2C.
                  Passed:
                      UB8  bSLA   = BiTEKbus slave address.
                      UW16 wREG   = BiTEKbus register address.
                      UB8  bCNT   = The number of data which will be transmitted
                          excluding slave and register address (bCNT: 1..255).
                      UB8  bDATA  = The repeated data.
                  Returns: None.
                  Notes:
                 ------------------------------------------------------------------- */
              void BITEK_TxRepeat (
              UB8  bSLA,          /* BITEK slave address */
              UW16 wREG,          /* BITEK register address */
              UB8  bCNT,          /* The number of data which will be transmitted */
              UB8  bDATA          /* The repeated DATA */
              )
              {
                  UB8 bIdx;
              
                  if (bCNT == 0)
                      return;
              
                  I2C_Start();
              
                  I2C_TxData(bSLA | (((wREG) >> 7) & 0x1E));
              
                  I2C_GetACK();
              
              
                  I2C_TxData(wREG);
                  I2C_GetACK();
              
              
                  /* --------------------------------
C51 COMPILER V7.50   BITEK                                                                 02/05/2007 16:33:24 PAGE 13  

                      Write Data
                     -------------------------------- */
                  for (bIdx = bCNT; bIdx; bIdx--)
                  {
                      I2C_TxData(bDATA);          
                      I2C_GetACK();               
                  } /* for */
              
              
                  I2C_Stop();
              } /* BITEK_TxRepeat */
              
              #endif
 743          
 744          /* -------------------------------------------------------------------
 745              Name:  -
 746              Purpose: .
 747              Passed: None.
 748              Returns: None.
 749              Notes:
 750             ------------------------------------------------------------------- */
 751          
 752          
 753          /* **********************************************************************
 754          
 755              Description:
 756          
 757          
 758             ********************************************************************** */
 759          
 760          /* %% End Of File %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
 761          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    416    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      1      21
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       1
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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