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

📄 1wire.lst

📁 通过车载终端采集GPS数据
💻 LST
字号:
C51 COMPILER V7.09   1WIRE                                                                 09/17/2008 16:02:37 PAGE 1   


C51 COMPILER V7.09, COMPILATION OF MODULE 1WIRE
OBJECT MODULE PLACED IN .\output\1wire.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE 1wire\1wire.c LARGE BROWSE INCDIR(audio\;eeprom\;extendUART\;flash\;gps\;in
                    -ter\;key\;mcu\;menu\;usb\;gprs\;main\;1wire\) DEBUG OBJECTEXTEND PRINT(.\output\1wire.lst) OBJECT(.\output\1wire.obj)

line level    source

   1          #include "w77e532.h"
   2          #include "1wire.h"
   3          #include <intrins.h>
   4          /************************************************************
   5          *Function:延时处理
   6          *parameter:
   7          *Return:
   8          *Modify:
   9          *************************************************************/
  10          void TempDelay (unsigned char us)
  11          {
  12   1          while(us--);
  13   1      }
  14          
  15          
  16          /****************************************
  17          *1-wire reset function
  18          *call this function before rom command and function command
  19          *return value:1 :have 1-wire device;0: no 1-wire device
  20          ******************************************/
  21          unsigned char wire1_reset()
  22          {
  23   1          bit presence;
  24   1          WIRE1_DQ = 1;
  25   1          _nop_();
  26   1          WIRE1_DQ = 0;
  27   1          TempDelay(86);   //delay 530 uS//80
  28   1          _nop_();    
  29   1          WIRE1_DQ = 1;
  30   1          TempDelay(14);   //delay 100 uS//14
  31   1          _nop_();
  32   1          _nop_();
  33   1          _nop_();
  34   1      
  35   1          presence = WIRE1_DQ;
  36   1          TempDelay(40);       //20//mod to 40//09-19
  37   1          _nop_();
  38   1          _nop_();
  39   1          WIRE1_DQ = 1;
  40   1          if (0 == presence)
  41   1              return 1;
  42   1          else
  43   1              return 0;
  44   1      }
  45          
  46          
  47          /******************************************
  48          *read a bit
  49          *return value: the bit readed
  50          *******************************************/
  51          unsigned char wire1_readbit()
  52          {
  53   1          unsigned char retVal, i;
  54   1          WIRE1_DQ = 0;
C51 COMPILER V7.09   1WIRE                                                                 09/17/2008 16:02:37 PAGE 2   

  55   1          i++;
  56   1          WIRE1_DQ = 1;
  57   1          i++;
  58   1          i++;
  59   1          i++;
  60   1          retVal = WIRE1_DQ;
  61   1          for(i=0; i<19; i++);
  62   1          return retVal;
  63   1      }
  64          
  65          /*******************************************
  66          *write a bit
  67          *bitval:write value
  68          *******************************************/
  69          void wire1_writebit(unsigned char bitval)
  70          {
  71   1          unsigned char i;
  72   1          WIRE1_DQ = 0;
  73   1          i++;
  74   1          if (bitval == 1)
  75   1              WIRE1_DQ = 1;
  76   1          for(i=0; i<18; i++);
  77   1          WIRE1_DQ = 1;
  78   1      }
  79          
  80          /********************************************
  81          *
  82          *********************************************/
  83          unsigned char wire1_readbyte()
  84          {
  85   1          unsigned char i,u=0;
  86   1          unsigned char temp;
  87   1          for(i=0;i<8;i++)
  88   1          {
  89   2              WIRE1_DQ = 0;
  90   2              u >>= 1;
  91   2              WIRE1_DQ = 1;
  92   2              temp = WIRE1_DQ;
  93   2              if(temp==1)
  94   2                  u |= 0x80;
  95   2              TempDelay(12);//25);//4);//mod to 12 09-19
  96   2          /**add09-19**/
  97   2              WIRE1_DQ = 1;
  98   2              TempDelay(1);
  99   2          /*end of add*/
 100   2              _nop_();
 101   2          }
 102   1          return(u);
 103   1      }
 104          
 105          /*******************************************
 106          *
 107          *******************************************/
 108          void wire1_writebyte(unsigned char value)
 109          {
 110   1          unsigned char i;
 111   1          for (i=0;i<8;i++)
 112   1          {
 113   2              WIRE1_DQ = 0;
 114   2              _nop_();
 115   2              WIRE1_DQ = value & 0x01;
 116   2              TempDelay(13);//25);//5);   //delay 45 uS //5//mod to 13 09-19
C51 COMPILER V7.09   1WIRE                                                                 09/17/2008 16:02:37 PAGE 3   

 117   2              _nop_();
 118   2              _nop_();
 119   2              WIRE1_DQ=1;
 120   2              value >>= 1;
 121   2              //add 
 122   2              TempDelay(1);
 123   2          }
 124   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    165    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   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 + -