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

📄 bitek.lst

📁 Bitek 公司 bit1611b模拟屏驱动芯片外接MCU驱动DEMO源码
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V7.50   BITEK                                                                 02/05/2007 16:33:24 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE BITEK
OBJECT MODULE PLACED IN .\OBJ\BITEK.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE BITEK.C ROM(COMPACT) OPTIMIZE(9,SPEED) NOAREGS DEFINE(PROJECT=DMO04015800,M
                    -CU_CFG=BIT5101,VP_IF_CFG=VP_IF_BITEK) PRINT(.\LST\BITEK.lst) OBJECT(.\OBJ\BITEK.obj)

line level    source

   1          /* **********************************************************************
   2          
   3                   Copyright (c) 2002-2006 Beyond Innovation Technology Co., Ltd
   4          
   5                  All rights are reserved. Reproduction in whole or in parts is
   6              prohibited without the prior written consent of the copyright owner.
   7             ----------------------------------------------------------------------
   8          
   9              Module: BITEK.C - BITEKbus.
  10          
  11              Purpose: Implementation of BITEK module.
  12          
  13              Version: 0.01                                   07:27PM  2005/05/13
  14          
  15              Compiler: Keil 8051 C Compiler v8.01
  16          
  17              Reference:
  18              [1] BIT1611B Datasheet Version 1.0, 2005-11-10, Beyond Innovation Technology
  19          
  20             ----------------------------------------------------------------------
  21              Modification:
  22          
  23              R0.01 07:27PM  2005/05/13 Jeffrey Chang
  24              Reason:
  25                  1. Original.
  26              Solution:
  27          
  28             ********************************************************************** */
  29          
  30          #define _BITEK_C_
  31          
  32          
  33          /* ------------------------------------
  34              Header Files
  35             ------------------------------------ */
  36          #include <intrins.h>
  37          #include "bitek.h"
  38          
  39          /* ------------------------------------
  40              Macro Definitions
  41             ------------------------------------ */
  42          #if (VP_IF_CFG == VP_IF_BITEK)
  43          
  44              #define NOP_24  { _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _no
             -p_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(
             -); _nop_();}
  45              #define NOP_20  { _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _no
             -p_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); }
  46              #define NOP_18  { _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _no
             -p_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); }
  47              #define NOP_15  { _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _no
             -p_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();  }
  48              #define NOP_12  { _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _no
             -p_(); _nop_(); _nop_();   }
C51 COMPILER V7.50   BITEK                                                                 02/05/2007 16:33:24 PAGE 2   

  49              #define NOP_10  { _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _no
             -p_();                     }
  50              #define NOP_3   { _nop_(); _nop_(); _nop_(); }
  51              #define NOP_2   { _nop_(); _nop_(); }
  52              #define NOP_1   { _nop_(); }
  53              #define NOP_0   {  }
  54          
  55              #define     LO_PULSE                NOP_1
  56              #define     HI_PULSE                NOP_1
  57          
  58          
  59              #define     BITEK_GET_SDAT_HIGH     (   BITEK_ioSDAT == HIGH    )
  60          
  61              #define     BITEK_SET_SCLK(HiLo)    {   BITEK_ioSCLK = (HiLo) ? HIGH : LOW; }
  62              #define     BITEK_SET_SDAT(HiLo)    {   BITEK_ioSDAT = (HiLo) ? HIGH : LOW; }
  63          
  64          #endif
  65          
  66          /* ------------------------------------
  67              Type Definitions
  68             ------------------------------------ */
  69          
  70          
  71          /* ------------------------------------
  72              Variables Definitions
  73             ------------------------------------ */
  74          #if (VP_IF_CFG == VP_IF_BITEK)
  75          
  76              sbit BITEK_ioSCLK   = P1 ^ 6;
  77              sbit BITEK_ioSDAT   = P1 ^ 7;
  78          #endif
  79          
  80          static UB8 bData;
  81          
  82          /* ------------------------------------
  83              Function Prototypes
  84             ------------------------------------ */
  85          #if (VP_IF_CFG == VP_IF_BITEK)
  86              static BOOL BITEK_GetACK(void);
  87              static UB8  BITEK_RxData(void);
  88              static void BITEK_Start(void);
  89              static void BITEK_Stop(void);
  90          
  91              #if (BITEK_SET_ACK)
                  static void BITEK_SetACK(void);
                  #endif
  94          
  95              static void BITEK_TxData(UB8 bData);
  96          #endif
  97          
  98          
  99          #if (VP_IF_CFG == VP_IF_BITEK)
 100          
 101          
 102          /* -------------------------------------------------------------------
 103              Name: BITEK_GetACK -
 104              Purpose: .
 105              Passed: None.
 106              Returns: LOW if OK
 107              Notes:
 108              1) The acknowledge-related clock pulse is generated by the master.
 109              2) The transmitter (Tx) release the SDA line (HIGH) during the
C51 COMPILER V7.50   BITEK                                                                 02/05/2007 16:33:24 PAGE 3   

 110                 acknowledge clock pulse.
 111              3) The receiver (Rx) must pull down the SDA line during the
 112                 acknowledge clock pulse so that it remains stable LOW during
 113                 the HIGH period of this clock pulse.
 114            ------------------------------------------------------------------- */
 115          BOOL BITEK_GetACK (void)
 116          {
 117   1          BOOL    fResult;
 118   1      
 119   1      
 120   1          BITEK_SET_SDAT(HIGH);
 121   1          HI_PULSE;
 122   1      
 123   1          BITEK_SET_SCLK(HIGH);
 124   1          HI_PULSE;
 125   1      
 126   1          fResult = BITEK_GET_SDAT_HIGH;
 127   1          HI_PULSE;
 128   1      
 129   1          BITEK_SET_SCLK(LOW);
 130   1          LO_PULSE;
 131   1      
 132   1          return( fResult );
 133   1      } /* BITEK_GetACK */
 134          
 135          
 136          /* -------------------------------------------------------------------
 137              Name: BITEK_Init - (VP_IF_BITEK)
 138              Purpose: To initialize the BITEK module.
 139              Passed: None.
 140              Returns: None.
 141              Notes:
 142            ------------------------------------------------------------------- */
 143          void BITEK_Init (void)
 144          {
 145   1          BITEK_SET_SDAT(HIGH);
 146   1          BITEK_SET_SCLK(HIGH);
 147   1      } /* BITEK_Init */
 148          
 149          
 150          #if (BITEK_RX_BURST)
              /* -------------------------------------------------------------------
                  Name: BITEK_RxBurst -
                  Purpose: To receive bulk data from BITEK slave device.
                  Passed:
                      UB8     bSLA    = BITEK slave address
                      UW16    wREG    = BITEK register address
                      UB8     bCNT    = The number of data which will be received
                          bCNT: 1..255. (Excludes slave and register addresses)
                      UB8     *pbDATA = The pointer which points to the first DATA item
                  Returns: None.
                  Notes:
                 ------------------------------------------------------------------- */
              void BITEK_RxBurst (
              UB8     bSLA,               /* BITEK slave address */
              UW16    wREG,               /* BITEK register address */
              UB8     bCNT,               /* The number of data which will be transmitted */
              UB8     *pbDATA             /* The pointer which points to the first DATA item */
              )
              {
                  UB8     bIdx;
              
C51 COMPILER V7.50   BITEK                                                                 02/05/2007 16:33:24 PAGE 4   

              
                  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) | 0x01);
                  BITEK_GetACK();
              
              
                  /* --------------------------------
                      Read
                     -------------------------------- */
                  for (bIdx = (bCNT - 1); bIdx; bIdx--)
                  {
                      *pbDATA++ = BITEK_RxData();
              
                      BITEK_SetACK();                   
                  } /* for */
              
                  // Reading last one without ACK !
                  *pbDATA = BITEK_RxData();
              
              
                  BITEK_Stop();
              } /* BITEK_RxBurst */
              #endif
 210          
 211          
 212          #if (BITEK_RX_BYTE)
 213          /* -------------------------------------------------------------------
 214              Name: BITEK_RxByte -
 215              Purpose: To receive one byte data from BiTEKbus slave device.
 216              Passed:
 217                  UB8     bSLA    = BITEK slave address.
 218                  UW16    wREG    = BITEK register address.
 219              Returns: One byte received data.
 220              Notes:
 221             ------------------------------------------------------------------- */
 222          UB8 BITEK_RxByte (
 223          UB8     bSLA,           /* BITEK slave address */
 224          UW16    wREG            /* BITEK register address */
 225          )
 226          {
 227   1          UB8    bDATA;
 228   1      
 229   1      
 230   1          BITEK_Start();
 231   1      
 232   1          BITEK_TxData(bSLA);
 233   1      
C51 COMPILER V7.50   BITEK                                                                 02/05/2007 16:33:24 PAGE 5   

 234   1          BITEK_GetACK();
 235   1      
 236   1      
 237   1          // If Extension = 1 !
 238   1          if (bSLA & 0x01)
 239   1          {
 240   2              // MSB Slave Address [14:7]
 241   2              BITEK_TxData(wREG >> 7);
 242   2      
 243   2              BITEK_GetACK();
 244   2          }
 245   1      
 246   1          // LSB Slave Address [6:0]
 247   1          BITEK_TxData((wREG << 1) | 0x01);           // Read Operation !
 248   1          BITEK_GetACK();

⌨️ 快捷键说明

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