###############################################################################
#                                                                             #
# IAR 8051 C/C++ Compiler V7.30B/W32                    21/Jun/2010  16:50:55 #
# Copyright 2004-2007 IAR Systems. All rights reserved.                       #
#                                                                             #
#    Core               =  plain                                              #
#    Code model         =  banked                                             #
#    Data model         =  large                                              #
#    Calling convention =  xdata reentrant                                    #
#    Constant location  =  data                                               #
#    Dptr setup         =  1,16                                               #
#    Source file        =  C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\z #
#                          stack\Samples\Location\Source\Sensor_18B20.c       #
#    Command line       =  -f "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projec #
#                          ts\zstack\Samples\Location\CC2430DB\..\..\..\Tools #
#                          \CC2430DB\f8wCoord.cfg" (-DCPU32MHZ                #
#                          -DFORCE_MAC_NEAR -DROOT=__near_func                #
#                          -DMAC_CFG_APP_PENDING_QUEUE=TRUE                   #
#                          -DZDO_COORDINATOR -DRTR_NWK -DBLINK_LEDS           #
#                          "-DCONST=const __code" -DGENERIC=__generic) -f     #
#                          "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\ #
#                          zstack\Samples\Location\CC2430DB\..\..\..\Tools\CC #
#                          2430DB\f8wConfig.cfg" (-DSECURE=1                  #
#                          -DDEFAULT_CHANLIST=0x04000000                      #
#                          -DZDAPP_CONFIG_PAN_ID=0x00FF                       #
#                          -DNWK_START_DELAY=100 -DEXTENDED_JOINING_RANDOM_MA #
#                          SK=0x007F -DBEACON_REQUEST_DELAY=100               #
#                          -DBEACON_REQ_DELAY_MASK=0x00FF                     #
#                          -DROUTE_EXPIRY_TIME=30 -DAPSC_ACK_WAIT_DURATION_PO #
#                          LLED=3000 -DNWK_INDIRECT_MSG_TIMEOUT=7             #
#                          -DMAX_RREQ_ENTRIES=10 -DAPSC_MAX_FRAME_RETRIES=3   #
#                          -DNWK_MAX_DATA_RETRIES=2                           #
#                          -DMAX_POLL_FAILURE_RETRIES=2 -DMAX_BCAST=9         #
#                          -DAPS_MAX_GROUPS=16 -DMAX_RTG_ENTRIES=20           #
#                          -DNWK_MAX_BINDING_ENTRIES=10                       #
#                          -DMAX_BINDING_CLUSTER_IDS=5 "-DDEFAULT_KEY={0x02,  #
#                          0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x00,    #
#                          0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0D}"         #
#                          -DRFD_RCVC_ALWAYS_ON=FALSE -DPOLL_RATE=1000        #
#                          -DQUEUED_POLL_RATE=100 -DRESPONSE_POLL_RATE=100)   #
#                          -DREJOIN_POLL_RATE=440 "C:\Texas                   #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\Source\Sensor_18B20.c" -D CC2430EB   #
#                          -D ZTOOL_P1 -D LOCATION_DONGLE -D MT_TASK -D       #
#                          xNV_RESTORE -D INT_HEAP_LEN=4608 -D                #
#                          HAL_UART_BIG_TX_BUF=1 -D                           #
#                          SPI_MGR_DEFAULT_MAX_TX_BUFF=1024 -D                #
#                          SPI_MGR_DEFAULT_OVERFLOW=1 -lC "C:\Texas           #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\LocDongle\List\" -lA        #
#                          "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\ #
#                          zstack\Samples\Location\CC2430DB\LocDongle\List\"  #
#                          --diag_suppress Pe001,Pa010 --diag_remark pe550    #
#                          -o "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projec #
#                          ts\zstack\Samples\Location\CC2430DB\LocDongle\Obj\ #
#                          " -e --require_prototypes -z9 --no_code_motion     #
#                          --debug --core=plain --dptr=16,1                   #
#                          --data_model=large --code_model=banked             #
#                          --calling_convention=xdata_reentrant               #
#                          --place_constants=data --nr_virtual_regs 8 -I      #
#                          "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\ #
#                          zstack\Samples\Location\CC2430DB\" -I "C:\Texas    #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\SOURCE\" -I "C:\Texas    #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\ZMAIN\TI2430DB\"   #
#                          -I "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projec #
#                          ts\zstack\Samples\Location\CC2430DB\..\..\..\..\WX #
#                          L\INCLUDE\" -I "C:\Texas                           #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\M #
#                          T\" -I "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Pr #
#                          ojects\zstack\Samples\Location\CC2430DB\..\..\..\. #
#                          .\..\COMPONENTS\HAL\INCLUDE\" -I "C:\Texas         #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\H #
#                          AL\TARGET\CC2430EB\" -I "C:\Texas                  #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\O #
#                          SAL\MCU\CCSOC\" -I "C:\Texas                       #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\O #
#                          SAL\INCLUDE\" -I "C:\Texas                         #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\S #
#                          TACK\AF\" -I "C:\Texas Instruments\ZStack-1.4.3-1. #
#                          2.1\Projects\zstack\Samples\Location\CC2430DB\..\. #
#                          .\..\..\..\COMPONENTS\STACK\NWK\" -I "C:\Texas     #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\S #
#                          TACK\SEC\" -I "C:\Texas Instruments\ZStack-1.4.3-1 #
#                          .2.1\Projects\zstack\Samples\Location\CC2430DB\..\ #
#                          ..\..\..\..\COMPONENTS\STACK\SYS\" -I "C:\Texas    #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\S #
#                          TACK\ZDO\" -I "C:\Texas Instruments\ZStack-1.4.3-1 #
#                          .2.1\Projects\zstack\Samples\Location\CC2430DB\..\ #
#                          ..\..\..\..\COMPONENTS\ZMAC\F8W\" -I "C:\Texas     #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\Z #
#                          MAC\" -I "C:\Texas Instruments\ZStack-1.4.3-1.2.1\ #
#                          Projects\zstack\Samples\Location\CC2430DB\..\..\.. #
#                          \..\..\COMPONENTS\SERVICES\SADDR\" -I "C:\Texas    #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\S #
#                          ERVICES\SDATA\" -I "C:\Texas                       #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\M #
#                          AC\INCLUDE\" -I "C:\Texas                          #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\M #
#                          AC\HIGH_LEVEL\" -I "C:\Texas                       #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\M #
#                          AC\LOW_LEVEL\SRF03\" -I "C:\Texas                  #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\M #
#                          AC\LOW_LEVEL\SRF03\SINGLE_CHIP\" -I "C:\Program    #
#                          Files\IAR Systems\Embedded Workbench 4.0           #
#                          Evaluation version\8051\INC\" -I "C:\Program       #
#                          Files\IAR Systems\Embedded Workbench 4.0           #
#                          Evaluation version\8051\INC\CLIB\"                 #
#    List file          =  C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\z #
#                          stack\Samples\Location\CC2430DB\LocDongle\List\Sen #
#                          sor_18B20.lst                                      #
#    Object file        =  C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\z #
#                          stack\Samples\Location\CC2430DB\LocDongle\Obj\Sens #
#                          or_18B20.r51                                       #
#                                                                             #
#                                                                             #
###############################################################################

C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Samples\Location\Source\Sensor_18B20.c
      1          
      2          /*********************************************************************  
      3          *文件名:18B20.c
      4          *功能：DS18B20温度采集 
      5          * @data:2009.4.24
      6          * by mchen
      7          *********************************************************************/  
      8          #include "Sensor_18B20.h"

   \                                 In  segment SFR_AN, at 0x80
   \   union <unnamed> volatile __sfr _A_P0
   \                     _A_P0:
   \   000000                DS 1

   \                                 In  segment SFR_AN, at 0xfd
   \   unsigned char volatile __sfr P0DIR
   \                     P0DIR:
   \   000000                DS 1
      9          #include "ioCC2430.h"
     10          

   \                                 In  segment XDATA_Z, align 1, keep-with-next
     11          unsigned char sensor_data_value[2];
   \                     sensor_data_value:
   \   000000                DS 2
   \   000002                REQUIRE __INIT_XDATA_Z

   \                                 In  segment XDATA_Z, align 1, keep-with-next
     12          unsigned char flag;
   \                     flag:
   \   000000                DS 1
   \   000001                REQUIRE __INIT_XDATA_Z

   \                                 In  segment XDATA_Z, align 1, keep-with-next
     13          unsigned int data_value;
   \                     data_value:
   \   000000                DS 2
   \   000002                REQUIRE __INIT_XDATA_Z
     14          
     15          

   \                                 In  segment XDATA_I, align 1, keep-with-next
     16          static unsigned char get_serial[]={
   \                     get_serial:
   \   000000                DS 32
   \   000020                REQUIRE `?<Initializer for get_serial>`
   \   000020                REQUIRE __INIT_XDATA_I
     17            0x1C,0x00,0x00,0x02,0x02,0x68,0xd8,0x28,
     18            0x9E,0x00,0x00,0x02,0x02,0x93,0x34,0x28,
     19            0xE4,0x00,0x00,0x02,0x02,0x66,0x4D,0x28,
     20            0xE6,0x00,0x00,0x02,0x02,0x93,0x9B,0x28
     21            //0xF7,0x00,0x00,0x02,0x02,0x75,0xE1,0x28
     22           };
     23          
     24          

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
     25          void Delay_nus(uint16 s) 
   \                     Delay_nus:
     26          {
   \   000000                ; Saved register size: 0
   \   000000                ; Auto size: 0
   \   000000   8003         SJMP    ??Delay_nus_0
     27            while (s--)
     28            {
     29              asm("NOP");
   \                     ??Delay_nus_1:
   \   000002   00           NOP
     30              asm("NOP");
   \   000003   00           NOP
     31              asm("NOP");
   \   000004   00           NOP
     32            }
   \                     ??Delay_nus_0:
   \   000005   EA           MOV     A,R2
   \   000006   F8           MOV     R0,A
   \   000007   EB           MOV     A,R3
   \   000008   F9           MOV     R1,A
   \   000009   74FF         MOV     A,#-0x1
   \   00000B   28           ADD     A,R0
   \   00000C   1A           DEC     R2
   \   00000D   74FF         MOV     A,#-0x1
   \   00000F   39           ADDC    A,R1
   \   000010   FB           MOV     R3,A
   \   000011   E8           MOV     A,R0
   \   000012   7001         JNZ     ??Delay_nus_2
   \   000014   E9           MOV     A,R1
   \                     ??Delay_nus_2:
   \   000015   70EB         JNZ     ??Delay_nus_1
     33          }
   \   000017   02....       LJMP    ?BRET
     34          

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
     35          void write_1820(unsigned char x)  
   \                     write_1820:
     36          {  unsigned char m;    
   \   000000   74F6         MOV     A,#-0xa
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 10
   \   000005                ; Auto size: 0
   \   000005   E9           MOV     A,R1
   \   000006   FF           MOV     R7,A
     37              SET_OUT;
   \   000007   43FD04       ORL     0xfd,#0x4
     38              for(m=0;m<8;m++)  
   \   00000A   7E00         MOV     R6,#0x0
     39              {  
     40                 CL_DQ;
   \                     ??write_1820_0:
   \   00000C   C282         CLR     0x80.2
     41                 if(x&(1<<m))    //写数据，从低位开始  
   \   00000E   75..01       MOV     ?V0 + 0,#0x1
   \   000011   75..00       MOV     ?V0 + 1,#0x0
   \   000014   EE           MOV     A,R6
   \   000015   78..         MOV     R0,#?V0 + 0
   \   000017   12....       LCALL   ?S_SHL
   \   00001A   E5..         MOV     A,?V0 + 0
   \   00001C   5F           ANL     A,R7
   \   00001D   6004         JZ      ??write_1820_1
     42                 SET_DQ; 
   \   00001F   D282         SETB    0x80.2
   \   000021   8002         SJMP    ??write_1820_2
     43                 else  
     44                 CL_DQ;  
   \                     ??write_1820_1:
   \   000023   C282         CLR     0x80.2
     45                 Delay_nus(40);   //15~60us  
   \                     ??write_1820_2:
   \   000025                ; Setup parameters for call to function Delay_nus
   \   000025   7A28         MOV     R2,#0x28
   \   000027   7B00         MOV     R3,#0x0
   \   000029   12....       LCALL   ??Delay_nus?relay
     46                 SET_DQ;  
   \   00002C   D282         SETB    0x80.2
     47              }
   \   00002E   0E           INC     R6
   \   00002F   EE           MOV     A,R6
   \   000030   C3           CLR     C
   \   000031   9408         SUBB    A,#0x8
   \   000033   40D7         JC      ??write_1820_0
     48              //SET_OUT;
     49              SET_DQ;  
   \   000035   D282         SETB    0x80.2
     50          }  
   \   000037                REQUIRE ?Subroutine3
   \   000037                REQUIRE _A_P0
   \   000037                REQUIRE P0DIR
   \   000037                ; // Fall through to label ?Subroutine3

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine3:
   \   000000   7F02         MOV     R7,#0x2
   \   000002   02....       LJMP    ?BANKED_LEAVE_XDATA
     51          

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
     52          unsigned char read_1820(void)  
   \                     read_1820:
     53          {   unsigned char temp,k,n;    
   \   000000   74F4         MOV     A,#-0xc
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 12
   \   000005                ; Auto size: 0
     54              temp=0;  
   \   000005   75..00       MOV     ?V0 + 0,#0x0
     55              for(n=0;n<8;n++)  
   \   000008   7E00         MOV     R6,#0x0
     56                 {  
     57                CL_DQ;     
   \                     ??read_1820_0:
   \   00000A   C282         CLR     0x80.2
     58                SET_DQ; 
   \   00000C   D282         SETB    0x80.2
     59                SET_IN;  
   \   00000E   53FDFB       ANL     0xfd,#0xfb
     60                k=IN_DQ;    //读数据,从低位开始  
   \   000011   A282         MOV     C,0x80.2
   \   000013   E4           CLR     A
   \   000014   92E0         MOV     0xE0 /* A   */.0,C
     61                if(k)  
   \   000016   75..01       MOV     ?V0 + 2,#0x1
   \   000019   75..00       MOV     ?V0 + 3,#0x0
   \   00001C   600C         JZ      ??read_1820_1
     62                temp|=(1<<n);  
   \   00001E   EE           MOV     A,R6
   \   00001F   78..         MOV     R0,#?V0 + 2
   \   000021   12....       LCALL   ?S_SHL
   \   000024   E5..         MOV     A,?V0 + 2
   \   000026   42..         ORL     ?V0 + 0,A
   \   000028   800B         SJMP    ??read_1820_2
     63                else  
     64                temp&=~(1<<n);  
   \                     ??read_1820_1:
   \   00002A   EE           MOV     A,R6
   \   00002B   78..         MOV     R0,#?V0 + 2
   \   00002D   12....       LCALL   ?S_SHL
   \   000030   E5..         MOV     A,?V0 + 2
   \   000032   F4           CPL     A
   \   000033   52..         ANL     ?V0 + 0,A
     65                Delay_nus(70); //60~120us      
   \                     ??read_1820_2:
   \   000035                ; Setup parameters for call to function Delay_nus
   \   000035   7A46         MOV     R2,#0x46
   \   000037   7B00         MOV     R3,#0x0
   \   000039   12....       LCALL   ??Delay_nus?relay
     66                SET_OUT;
   \   00003C   43FD04       ORL     0xfd,#0x4
     67          
     68             }  
   \   00003F   0E           INC     R6
   \   000040   EE           MOV     A,R6
   \   000041   C3           CLR     C
   \   000042   9408         SUBB    A,#0x8
   \   000044   40C4         JC      ??read_1820_0
     69             return (temp);  
   \   000046   A9..         MOV     R1,?V0 + 0
   \   000048                REQUIRE ?Subroutine4
   \   000048                REQUIRE _A_P0
   \   000048                REQUIRE P0DIR
   \   000048                ; // Fall through to label ?Subroutine4
     70          }  

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine4:
   \   000000   7F04         MOV     R7,#0x4
   \   000002   02....       LJMP    ?BANKED_LEAVE_XDATA
     71          
     72          /*功能匹配*/

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
     73          BYTE match_rom(unsigned char *rom)
   \                     match_rom:
     74          {
   \   000000   74F4         MOV     A,#-0xc
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 12
   \   000005                ; Auto size: 0
   \   000005   EA           MOV     A,R2
   \   000006   FE           MOV     R6,A
   \   000007   EB           MOV     A,R3
   \   000008   FF           MOV     R7,A
     75           unsigned char i;
     76           init_1820();
   \   000009                ; Setup parameters for call to function init_1820
   \   000009   12....       LCALL   ??init_1820?relay
     77           write_1820(0x55);
   \   00000C                ; Setup parameters for call to function write_1820
   \   00000C   7955         MOV     R1,#0x55
   \   00000E   12....       LCALL   ??write_1820?relay
     78           for(i=8;i>0;i--)
   \   000011   75..08       MOV     ?V0 + 0,#0x8
     79           {
     80                    write_1820(*(rom+i-1));
   \                     ??match_rom_0:
   \   000014                ; Setup parameters for call to function write_1820
   \   000014   85....       MOV     ?V0 + 2,?V0 + 0
   \   000017   EE           MOV     A,R6
   \   000018   25..         ADD     A,?V0 + 2
   \   00001A   F8           MOV     R0,A
   \   00001B   EF           MOV     A,R7
   \   00001C   3400         ADDC    A,#0x0
   \   00001E   F9           MOV     R1,A
   \   00001F   74FF         MOV     A,#-0x1
   \   000021   28           ADD     A,R0
   \   000022   F582         MOV     DPL,A
   \   000024   74FF         MOV     A,#-0x1
   \   000026   39           ADDC    A,R1
   \   000027   F583         MOV     DPH,A
   \   000029   E0           MOVX    A,@DPTR
   \   00002A   F9           MOV     R1,A
   \   00002B   12....       LCALL   ??write_1820?relay
     81           }
   \   00002E   15..         DEC     ?V0 + 0
   \   000030   E5..         MOV     A,?V0 + 0
   \   000032   70E0         JNZ     ??match_rom_0
     82           return 1;
   \   000034   7901         MOV     R1,#0x1
   \   000036   80..         SJMP    ?Subroutine4
     83          }
     84          

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
     85          void init_1820(void) 
   \                     init_1820:
     86          {
   \   000000   C082         PUSH    DPL
   \   000002   C083         PUSH    DPH
   \   000004                ; Saved register size: 2
   \   000004                ; Auto size: 0
     87             //cli(); 
     88            SET_OUT; 
   \   000004   43FD04       ORL     0xfd,#0x4
     89            SET_DQ;//输出1
   \   000007   D282         SETB    0x80.2
     90            CL_DQ; 
   \   000009   C282         CLR     0x80.2
     91            Delay_nus(550);//拉低一段时间 
   \   00000B                ; Setup parameters for call to function Delay_nus
   \   00000B   7A26         MOV     R2,#0x26
   \   00000D   7B02         MOV     R3,#0x2
   \   00000F   12....       LCALL   ??Delay_nus?relay
     92            SET_DQ;//释放 
   \   000012   D282         SETB    0x80.2
     93            SET_IN;//输入 
   \   000014   53FDFB       ANL     0xfd,#0xfb
     94            Delay_nus(40); //释放总线后等待15-60us
   \   000017                ; Setup parameters for call to function Delay_nus
   \   000017   7A28         MOV     R2,#0x28
   \   000019   7B00         MOV     R3,#0x0
   \   00001B   12....       LCALL   ??Delay_nus?relay
     95            while(IN_DQ)  {;}//等待回复 
   \                     ??init_1820_0:
   \   00001E   A282         MOV     C,0x80.2
   \   000020   40FC         JC      ??init_1820_0
     96            Delay_nus(240);//回复的低电平在60到240us  
   \   000022                ; Setup parameters for call to function Delay_nus
   \   000022   7AF0         MOV     R2,#-0x10
   \   000024   7B00         MOV     R3,#0x0
   \   000026   12....       LCALL   ??Delay_nus?relay
     97            SET_OUT; 
   \   000029   43FD04       ORL     0xfd,#0x4
     98            SET_DQ;//回到初始DQ=1；
   \   00002C   D282         SETB    0x80.2
     99           }
   \   00002E   D083         POP     DPH
   \   000030   D082         POP     DPL
   \   000032   02....       LJMP    ?BRET
   \   000035                REQUIRE _A_P0
   \   000035                REQUIRE P0DIR
    100           

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    101          void read_data(unsigned char *serial)
   \                     read_data:
    102           {
   \   000000   74F7         MOV     A,#-0x9
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 9
   \   000005                ; Auto size: 0
    103              unsigned int j; 
    104              unsigned char temh,teml; 
    105              unsigned char a,b,c;
    106           
    107              init_1820();  //复位18b20  
   \   000005                ; Setup parameters for call to function init_1820
   \   000005   12....       LCALL   ?Subroutine1 & 0xFFFF
    108              write_1820(0xcc);   // 发出转换命令 搜索器件 
    109              write_1820(0x44);     //启动 
    110              for(j=20;j>1;j--)  
   \                     ??CrossCallReturnLabel_2:
   \   000008   7E13         MOV     R6,#0x13
    111              Delay_nus(50000);
   \                     ??read_data_0:
   \   00000A                ; Setup parameters for call to function Delay_nus
   \   00000A   7A50         MOV     R2,#0x50
   \   00000C   7BC3         MOV     R3,#-0x3d
   \   00000E   12....       LCALL   ??Delay_nus?relay
   \   000011   1E           DEC     R6
   \   000012   EE           MOV     A,R6
   \   000013   70F5         JNZ     ??read_data_0
    112              init_1820();  
   \   000015                ; Setup parameters for call to function init_1820
   \   000015   12....       LCALL   ?Subroutine0 & 0xFFFF
    113              write_1820(0xcc);
    114              //match_rom(serial);   //匹配
    115              write_1820(0xbe); 
    116                   
    117              teml=read_1820();  //读数据  
    118              temh=read_1820();  
    119              if(temh&0x80)//判断正负
   \                     ??CrossCallReturnLabel_0:
   \   000018   A2E7         MOV     C,0xE0 /* A   */.7
   \   00001A   5018         JNC     ??read_data_1
    120              {
    121                flag=1;
   \   00001C   7401         MOV     A,#0x1
   \   00001E   90....       MOV     DPTR,#flag
   \   000021   F0           MOVX    @DPTR,A
    122                c=0;
    123                c=c|temh;
    124                c=c&0x00ff;
    125                c=c<<8;
    126                a=c;
    127            
    128                a=c|teml;
    129           
    130                a=(a^0xffff);//异或
    131                a=a+1;  //取反加1
   \   000022   74FF         MOV     A,#-0x1
   \   000024   65..         XRL     A,?V0 + 0
   \   000026   04           INC     A
   \   000027   FA           MOV     R2,A
    132                teml=a&0x0f;
   \   000028   740F         MOV     A,#0xf
   \   00002A   5A           ANL     A,R2
   \   00002B   F5..         MOV     ?V0 + 0,A
    133                temh=a>>4;
   \   00002D   EA           MOV     A,R2
   \   00002E   C4           SWAP    A
   \   00002F   540F         ANL     A,#0xf
   \   000031   FA           MOV     R2,A
   \   000032   8018         SJMP    ??read_data_2
    134              }
    135              else
    136              {
    137                flag=0;   //为正
   \                     ??read_data_1:
   \   000034   E4           CLR     A
   \   000035   90....       MOV     DPTR,#flag
   \   000038   F0           MOVX    @DPTR,A
    138                a=temh<<4;
    139                a+=(teml&0xf0)>>4; //得到高位的值
    140                b=teml&0x0f;
    141                temh=a;
   \   000039   E5..         MOV     A,?V0 + 0
   \   00003B   C4           SWAP    A
   \   00003C   540F         ANL     A,#0xf
   \   00003E   C0E0         PUSH    A
   \   000040   EA           MOV     A,R2
   \   000041   C4           SWAP    A
   \   000042   54F0         ANL     A,#0xf0
   \   000044   FA           MOV     R2,A
   \   000045   D0E0         POP     A
   \   000047   2A           ADD     A,R2
   \   000048   FA           MOV     R2,A
    142                teml=b&0x00ff;
   \   000049   53..0F       ANL     ?V0 + 0,#0xf
    143              }
    144              sensor_data_value[0]=teml;
   \                     ??read_data_2:
   \   00004C   E5..         MOV     A,?V0 + 0
   \   00004E   90....       MOV     DPTR,#sensor_data_value
   \   000051   F0           MOVX    @DPTR,A
    145              sensor_data_value[1]=temh;
   \   000052   EA           MOV     A,R2
   \   000053   90....       MOV     DPTR,#(sensor_data_value + 1)
   \   000056   F0           MOVX    @DPTR,A
    146           }
   \   000057   7F01         MOV     R7,#0x1
   \   000059   02....       LJMP    ?BANKED_LEAVE_XDATA

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine1:
   \   000000   12....       LCALL   ?Subroutine2 & 0xFFFF
   \                     ??CrossCallReturnLabel_4:
   \   000003                ; Setup parameters for call to function write_1820
   \   000003                ; Setup parameters for call to function write_1820
   \   000003   7944         MOV     R1,#0x44
   \   000005   12....       LCALL   ??write_1820?relay
   \   000008   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine0:
   \   000000   12....       LCALL   ?Subroutine2 & 0xFFFF
   \                     ??CrossCallReturnLabel_5:
   \   000003                ; Setup parameters for call to function write_1820
   \   000003                ; Setup parameters for call to function write_1820
   \   000003   79BE         MOV     R1,#-0x42
   \   000005   12....       LCALL   ??write_1820?relay
   \   000008                ; Setup parameters for call to function read_1820
   \   000008                ; Setup parameters for call to function read_1820
   \   000008   12....       LCALL   ??read_1820?relay
   \   00000B   E9           MOV     A,R1
   \   00000C   F5..         MOV     ?V0 + 0,A
   \   00000E                ; Setup parameters for call to function read_1820
   \   00000E                ; Setup parameters for call to function read_1820
   \   00000E   12....       LCALL   ??read_1820?relay
   \   000011   E9           MOV     A,R1
   \   000012   FA           MOV     R2,A
   \   000013   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine2:
   \   000000   12....       LCALL   ??init_1820?relay
   \   000003                ; Setup parameters for call to function write_1820
   \   000003                ; Setup parameters for call to function write_1820
   \   000003                ; Setup parameters for call to function write_1820
   \   000003                ; Setup parameters for call to function write_1820
   \   000003   79CC         MOV     R1,#-0x34
   \   000005   12....       LCALL   ??write_1820?relay
   \   000008   22           RET
    147          
    148           

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    149          unsigned int read_data_value(void)
   \                     read_data_value:
    150           {
   \   000000   74F6         MOV     A,#-0xa
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 10
   \   000005                ; Auto size: 0
    151          //    unsigned int j; 
    152              unsigned char temh,teml; 
    153          //    unsigned char a,b,c;
    154          //    unsigned int data_value;
    155           
    156              init_1820();  //复位18b20  
   \   000005                ; Setup parameters for call to function init_1820
   \   000005   12....       LCALL   ?Subroutine1 & 0xFFFF
    157              write_1820(0xcc);   // 发出转换命令 搜索器件 
    158              write_1820(0x44);     //启动 
    159          //    for(j=20;j>1;j--)  
    160          //    Delay_nus(500);
    161              init_1820();  
   \                     ??CrossCallReturnLabel_3:
   \   000008                ; Setup parameters for call to function init_1820
   \   000008   12....       LCALL   ?Subroutine0 & 0xFFFF
    162              write_1820(0xcc);
    163              //match_rom(serial);   //匹配
    164              write_1820(0xbe); 
    165                   
    166              teml=read_1820();  //读数据  
    167              temh=read_1820();  
    168          
    169              sensor_data_value[0]=teml;
   \                     ??CrossCallReturnLabel_1:
   \   00000B   E5..         MOV     A,?V0 + 0
   \   00000D   90....       MOV     DPTR,#sensor_data_value
   \   000010   F0           MOVX    @DPTR,A
    170              sensor_data_value[1]=temh;
   \   000011   EA           MOV     A,R2
   \   000012   90....       MOV     DPTR,#(sensor_data_value + 1)
   \   000015   F0           MOVX    @DPTR,A
    171              
    172              data_value = temh;
    173              data_value = ( data_value << 8 )| teml;
   \   000016   E5..         MOV     A,?V0 + 0
   \   000018   90....       MOV     DPTR,#data_value
   \   00001B   F0           MOVX    @DPTR,A
   \   00001C   A3           INC     DPTR
   \   00001D   E9           MOV     A,R1
   \   00001E   F0           MOVX    @DPTR,A
    174          
    175              return data_value;
   \   00001F   90....       MOV     DPTR,#data_value
   \   000022   E0           MOVX    A,@DPTR
   \   000023   FA           MOV     R2,A
   \   000024   A3           INC     DPTR
   \   000025   E0           MOVX    A,@DPTR
   \   000026   FB           MOV     R3,A
   \   000027   02....       LJMP    ?Subroutine3 & 0xFFFF
    176              
    177           }
    178             
    179          ////////////处理数据部分/////////////////

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    180           void DataChange(unsigned char Temp_channel)
   \                     DataChange:
    181           {
   \   000000                ; Saved register size: 0
   \   000000                ; Auto size: 0
    182             unsigned char temh,teml;
    183             unsigned char ch[9];
    184             unsigned int num;
    185             unsigned i;
    186             
    187             teml=sensor_data_value[0];
    188             temh=sensor_data_value[1];
    189             i=(Temp_channel-0x31)*2;
    190             ch[0]=Temp_channel;//当前显示的传感器的编号
    191             ch[1]=' ';
    192             num=teml*625;          //小数部分的取值每位代表0.0625（精度）
    193             if(flag==1)            //判断正负温度
    194             {
    195               ch[2]='-';              //+0x2d 为变"-"ASCII码
    196             }
    197             else ch[2]='+';   
    198             if(temh/100==0)
    199               ch[3]=' ';
    200             else ch[3]=temh/100+0x30;      //+0x30 为变 0~9 ASCII码
    201             if((temh/10%10==0)&&(temh/100==0))
    202               ch[4]=' ';
    203             else ch[4]=temh/10%10+0x30;
    204             ch[5]=temh%10+0x30;
    205             ch[6]='.';
    206             ch[7]=num/1000+0x30;//忽略小数点后1位的数
    207             ch[8]='\0';
    208           //  Print(i,15,ch,1);   //显示温度值
    209           //  Print(i,80,"℃",1); //显示摄氏度标示  ℃
    210          }
   \   000000   02....       LJMP    ?BRET
    211          
    212          

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    213          void ds18b20_main()
   \                     ds18b20_main:
    214          {
   \   000000   74F6         MOV     A,#-0xa
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 10
   \   000005                ; Auto size: 0
   \   000005   801F         SJMP    ??ds18b20_main_0
    215            unsigned char i=0;
    216            while(1){
    217              read_data(get_serial+i*8);// 读取温度
   \                     ??ds18b20_main_1:
   \   000007                ; Setup parameters for call to function read_data
   \   000007   8E..         MOV     ?V0 + 0,R6
   \   000009   75..00       MOV     ?V0 + 1,#0x0
   \   00000C   7403         MOV     A,#0x3
   \   00000E   78..         MOV     R0,#?V0 + 0
   \   000010   12....       LCALL   ?S_SHL
   \   000013   E5..         MOV     A,?V0 + 0
   \   000015   24..         ADD     A,#(get_serial & 0xff)
   \   000017   FA           MOV     R2,A
   \   000018   E5..         MOV     A,?V0 + 1
   \   00001A   34..         ADDC    A,#((get_serial >> 8) & 0xff)
   \   00001C   FB           MOV     R3,A
   \   00001D   12....       LCALL   ??read_data?relay
    218              DataChange(i+0x31); //数据处理 
    219              i++ ;
   \   000020   0E           INC     R6
    220              if(i==4) i=0;
   \   000021   7404         MOV     A,#0x4
   \   000023   6E           XRL     A,R6
   \   000024   70E1         JNZ     ??ds18b20_main_1
   \                     ??ds18b20_main_0:
   \   000026   7E00         MOV     R6,#0x0
   \   000028   80DD         SJMP    ??ds18b20_main_1
    221            }
    222          }

   \                                 In  segment XDATA_ID, align 1, keep-with-next
   \                     `?<Initializer for get_serial>`:
   \   000000   1C000002     DB 28, 0, 0, 2, 2, 104, 216, 40, 158, 0, 0, 2, 2, 147, 52, 40, 228, 0
   \            0268D828
   \            9E000002
   \            02933428
   \            E400    
   \   000012   00020266     DB 0, 2, 2, 102, 77, 40, 230, 0, 0, 2, 2, 147, 155, 40
   \            4D28E600
   \            00020293
   \            9B28    

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??Delay_nus?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    Delay_nus

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??write_1820?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    write_1820

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??read_1820?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    read_1820

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??match_rom?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    match_rom

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??init_1820?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    init_1820

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??read_data?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    read_data

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??read_data_value?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    read_data_value

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??DataChange?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    DataChange

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ds18b20_main?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ds18b20_main
    223          

   Maximum stack usage in bytes:

     Function        ISTACK PSTACK XSTACK
     --------        ------ ------ ------
     DataChange          0      0      0
     Delay_nus           0      0     12
     ds18b20_main        0      0     10
       -> read_data      0      0     20
     init_1820           2      0     12
       -> Delay_nus      4      0      0
       -> Delay_nus      4      0      0
       -> Delay_nus      4      0      0
     match_rom           0      0     12
       -> init_1820      0      0     24
       -> write_1820     0      0     24
       -> write_1820     0      0     24
     read_1820           0      0     22
       -> Delay_nus      0      0     24
     read_data           1      0     19
       -> init_1820      0      0     18
       -> write_1820     0      0     18
       -> write_1820     0      0     18
       -> Delay_nus      0      0     18
       -> init_1820      0      0     18
       -> write_1820     0      0     18
       -> write_1820     0      0     18
       -> read_1820      0      0     18
       -> read_1820      0      0     18
     read_data_value     0      0     10
       -> init_1820      0      0     20
       -> write_1820     0      0     20
       -> write_1820     0      0     20
       -> init_1820      0      0     20
       -> write_1820     0      0     20
       -> write_1820     0      0     20
       -> read_1820      0      0     20
       -> read_1820      0      0     20
     write_1820          0      0     22
       -> Delay_nus      0      0     20


   Segment part sizes:

     Function/Label                Bytes
     --------------                -----
     _A_P0                            1
     P0DIR                            1
     sensor_data_value                2
     flag                             1
     data_value                       2
     get_serial                      32
     Delay_nus                       26
     write_1820                      55
     ?Subroutine3                     5
     read_1820                       72
     ?Subroutine4                     5
     match_rom                       56
     init_1820                       53
     read_data                       92
     ?Subroutine1                     9
     ?Subroutine0                    20
     ?Subroutine2                     9
     read_data_value                 42
     DataChange                       3
     ds18b20_main                    42
     ?<Initializer for get_serial>   32
     ??Delay_nus?relay                6
     ??write_1820?relay               6
     ??read_1820?relay                6
     ??match_rom?relay                6
     ??init_1820?relay                6
     ??read_data?relay                6
     ??read_data_value?relay          6
     ??DataChange?relay               6
     ??ds18b20_main?relay             6

 
 489 bytes in segment BANKED_CODE
  54 bytes in segment BANK_RELAYS
   2 bytes in segment SFR_AN
  32 bytes in segment XDATA_I
  32 bytes in segment XDATA_ID
   5 bytes in segment XDATA_Z
 
 575 bytes of CODE  memory
   0 bytes of DATA  memory (+ 2 bytes shared)
  37 bytes of XDATA memory

Errors: none
Warnings: none
