C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 1   


C51 COMPILER V9.52.0.0, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c BROWSE NOAREGS DEBUG OBJECTEXTEND CODE TABS(2)

line level    source

   1          
   2          #define   uCHAR unsigned char
   3          #define   uINT  unsigned int
   4          
   5          #include <Intrins.h>    // for _nop_()
   6          
   7          #include "REG_MA82G5Dxx.H"
   8          #include "delay.H"
   9          
  10          
  11          #define   AFS         0x80
  12          #define   CKCON2        0x40
  13          
  14          #define T0X12     0x04
  15          
  16          #define CR0     0x01
  17          #define CR1     0x02
  18          #define AA      0x04
  19          #define SI      0x08
  20          #define STO     0x10
  21          #define STA     0x20
  22          #define ENSI    0x40
  23          #define CR2     0x80
  24          
  25          #define _TWSI_TIME_MAX_   2000
  26          
  27          uCHAR tmp;
  28          uCHAR TWI0_Err;
  29          
  30          uCHAR I2C_Read(uCHAR Dev_Addr, uCHAR Reg_Addr)
  31          { 
  32   1        uCHAR usData = 0;
  33   1        uINT  cnt = 0;
  34   1      
  35   1        SICON |= STA;
  36   1        SICON &= ~SI;
  37   1        cnt = 0;
  38   1        while( (SICON&SI) != SI)
  39   1        {
  40   2          cnt++;
  41   2          if(cnt > _TWSI_TIME_MAX_)
  42   2          { 
  43   3            TWI0_Err = 1;
  44   3            goto TWI0R_End;
  45   3          }
  46   2        }
  47   1        SICON &= ~STA;
  48   1      
  49   1        SIDAT = Dev_Addr;             // send device address
  50   1        SICON &= ~SI;
  51   1        cnt = 0;
  52   1        while( (SICON&SI) != SI)
  53   1        {
  54   2          cnt++;
  55   2          if(cnt > _TWSI_TIME_MAX_)
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 2   

  56   2          { 
  57   3            TWI0_Err = 1;
  58   3            goto TWI0R_End;
  59   3          }
  60   2        }
  61   1      
  62   1        SIDAT = Reg_Addr;             // send register address
  63   1        SICON &= ~SI;
  64   1        cnt = 0;
  65   1        while( (SICON&SI) != SI)
  66   1        {
  67   2          cnt++;
  68   2          if(cnt > _TWSI_TIME_MAX_)
  69   2          { 
  70   3            TWI0_Err = 1;
  71   3            goto TWI0R_End;
  72   3          }
  73   2        }
  74   1      
  75   1      
  76   1        SICON |= STA;               // restart
  77   1        SICON &= ~SI;
  78   1        cnt = 0;
  79   1        while( (SICON&SI) != SI)
  80   1        {
  81   2          cnt++;
  82   2          if(cnt > _TWSI_TIME_MAX_)
  83   2          { 
  84   3            TWI0_Err = 1;
  85   3            goto TWI0R_End;
  86   3          }
  87   2        }
  88   1        SICON &= ~STA;
  89   1      
  90   1        SIDAT = Dev_Addr | 0x01;          // send device address
  91   1        SICON &= ~SI;
  92   1        cnt = 0;
  93   1        while( (SICON&SI) != SI)
  94   1        {
  95   2          cnt++;
  96   2          if(cnt > _TWSI_TIME_MAX_)
  97   2          { 
  98   3            TWI0_Err = 1;
  99   3            goto TWI0R_End;
 100   3          }
 101   2        }
 102   1      
 103   1        SICON &= ~SI;
 104   1        cnt = 0;
 105   1        while( (SICON&SI) != SI)
 106   1        {
 107   2          cnt++;
 108   2          if(cnt > _TWSI_TIME_MAX_)
 109   2          { 
 110   3            TWI0_Err = 1;
 111   3            goto TWI0R_End;
 112   3          }
 113   2        }
 114   1        usData = SIDAT;
 115   1      
 116   1        SICON |= STO;
 117   1        SICON &= ~SI;
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 3   

 118   1        cnt = 0;
 119   1        while((SICON&STO) == STO)
 120   1        { 
 121   2          cnt++;
 122   2          if(cnt > _TWSI_TIME_MAX_)
 123   2          { 
 124   3            TWI0_Err = 1;
 125   3            goto TWI0R_End;
 126   3          }
 127   2        }
 128   1      TWI0R_End:
 129   1        return usData;
 130   1      }
 131          
 132          void I2C_Write(uCHAR Dev_Addr, uCHAR Reg_Addr, uCHAR ucData)
 133          {
 134   1        uINT  cnt = 0;
 135   1        SICON |= STA;
 136   1        SICON &= ~SI;
 137   1        cnt = 0;
 138   1        while( (SICON&SI) != SI)
 139   1        {
 140   2          cnt++;
 141   2          if(cnt > _TWSI_TIME_MAX_)
 142   2          { 
 143   3            TWI0_Err = 1;
 144   3            goto TWI0W_End;
 145   3          }
 146   2        }
 147   1        SICON &= ~STA;
 148   1      
 149   1        SIDAT = Dev_Addr;             // send device address
 150   1        SICON &= ~SI;
 151   1        cnt = 0;
 152   1        while( (SICON&SI) != SI)
 153   1        {
 154   2          cnt++;
 155   2          if(cnt > _TWSI_TIME_MAX_)
 156   2          { 
 157   3            TWI0_Err = 1;
 158   3            goto TWI0W_End;
 159   3          }
 160   2        }
 161   1      
 162   1        SIDAT = Reg_Addr;             // send register address
 163   1        SICON &= ~SI;
 164   1        cnt = 0;
 165   1        while( (SICON&SI) != SI)
 166   1        {
 167   2          cnt++;
 168   2          if(cnt > _TWSI_TIME_MAX_)
 169   2          { 
 170   3            TWI0_Err = 1;
 171   3            goto TWI0W_End;
 172   3          }
 173   2        }
 174   1      
 175   1        SIDAT = ucData;               // send data
 176   1        SICON &= ~SI;
 177   1        cnt = 0;
 178   1        while( (SICON&SI) != SI)
 179   1        {
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 4   

 180   2          cnt++;
 181   2          if(cnt > _TWSI_TIME_MAX_)
 182   2          { 
 183   3            TWI0_Err = 1;
 184   3            goto TWI0W_End;
 185   3          }
 186   2        }
 187   1      
 188   1          SICON |= STO;
 189   1          SICON &= ~SI;
 190   1        cnt = 0;
 191   1        while( (SICON&STO) == STO)
 192   1        {
 193   2          cnt++;
 194   2          if(cnt > _TWSI_TIME_MAX_)
 195   2          { 
 196   3            TWI0_Err = 1;
 197   3            goto TWI0W_End;
 198   3          }
 199   2        }
 200   1      TWI0W_End:
 201   1        _nop_();
 202   1      }
 203          
 204          void Timer0_Initial(void)
 205          {
 206   1        TMOD = 0x02;
 207   1        TH0 = 0xEC;
 208   1        TL0 = 0xEC;
 209   1        TR0 = 1;
 210   1        AUXR2 = T0X12;
 211   1      
 212   1      }
 213          
 214          void TWI0_Init()
 215          {
 216   1        SICON=0x00;
 217   1        //P22,P24 is Open drain with pull high
 218   1        P2M0=P2M0|(P2M02|P2M04);
 219   1        SFRPI=1;
 220   1        P2M0=P2M1|(P2M12|P2M14);
 221   1        SFRPI=0;
 222   1        _nop_();
 223   1        _nop_();
 224   1        _nop_();
 225   1        AUXR3 = 0x06;           //sel P22/P24 as SCL/SDA   
 226   1        SICON = ( CR2 | ENSI | CR1 | CR0 );   //enable TWSI and clock source Timer0 overflow, I2C Freq is 100KHz.
 227   1      }
 228          
 229          void main(void)
 230          {
 231   1        Timer0_Initial();
 232   1        TWI0_Init();
 233   1        
 234   1      
 235   1        while(1)
 236   1        {
 237   2          TWI0_Err=0;
 238   2          I2C_Write(0xA0, 0xAA, 0xA5);
 239   2          if(TWI0_Err)
 240   2          {// TWI Err. Reset TWI 
 241   3            TWI0_Init();
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 5   

 242   3          }
 243   2          delay_ms(5);
 244   2        
 245   2          TWI0_Err=0;
 246   2          tmp = I2C_Read(0xA0, 0xAA);
 247   2          if(TWI0_Err)
 248   2          {// TWI Err. Reset TWI 
 249   3            TWI0_Init();
 250   3          }
 251   2          delay_ms(5);
 252   2            
 253   2        }
 254   1      }
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 6   

ASSEMBLY LISTING OF GENERATED OBJECT CODE


             ; FUNCTION _I2C_Read (BEGIN)
                                           ; SOURCE LINE # 30
;---- Variable 'Dev_Addr' assigned to Register 'R7' ----
;---- Variable 'Reg_Addr' assigned to Register 'R5' ----
                                           ; SOURCE LINE # 31
                                           ; SOURCE LINE # 32
;---- Variable 'usData' assigned to Register 'R6' ----
0000 E4                CLR     A
0001 FE                MOV     R6,A
                                           ; SOURCE LINE # 33
;---- Variable 'cnt' assigned to Register 'R2/R3' ----
0002 FB                MOV     R3,A
0003 FA                MOV     R2,A
                                           ; SOURCE LINE # 35
0004 43D420            ORL     SICON,#020H
                                           ; SOURCE LINE # 36
0007 53D4F7            ANL     SICON,#0F7H
                                           ; SOURCE LINE # 37
000A         ?C0001:
                                           ; SOURCE LINE # 38
000A E5D4              MOV     A,SICON
000C 20E311            JB      ACC.3,?C0002
                                           ; SOURCE LINE # 39
                                           ; SOURCE LINE # 40
000F 0B                INC     R3
0010 BB0001            CJNE    R3,#00H,?C0048
0013 0A                INC     R2
0014         ?C0048:
                                           ; SOURCE LINE # 41
0014 D3                SETB    C
0015 EB                MOV     A,R3
0016 94D0              SUBB    A,#0D0H
0018 EA                MOV     A,R2
0019 9407              SUBB    A,#07H
001B 40ED              JC      ?C0001
                                           ; SOURCE LINE # 42
                                           ; SOURCE LINE # 43
                                           ; SOURCE LINE # 44
001D 020000      R     LJMP    ?C0060
                                           ; SOURCE LINE # 45
                                           ; SOURCE LINE # 46
0020         ?C0002:
                                           ; SOURCE LINE # 47
0020 53D4DF            ANL     SICON,#0DFH
                                           ; SOURCE LINE # 49
0023 8FD2              MOV     SIDAT,R7
                                           ; SOURCE LINE # 50
0025 53D4F7            ANL     SICON,#0F7H
                                           ; SOURCE LINE # 51
0028 E4                CLR     A
0029 FA                MOV     R2,A
002A FB                MOV     R3,A
002B         ?C0005:
                                           ; SOURCE LINE # 52
002B E5D4              MOV     A,SICON
002D 20E311            JB      ACC.3,?C0006
                                           ; SOURCE LINE # 53
                                           ; SOURCE LINE # 54
0030 0B                INC     R3
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 7   

0031 BB0001            CJNE    R3,#00H,?C0049
0034 0A                INC     R2
0035         ?C0049:
                                           ; SOURCE LINE # 55
0035 D3                SETB    C
0036 EB                MOV     A,R3
0037 94D0              SUBB    A,#0D0H
0039 EA                MOV     A,R2
003A 9407              SUBB    A,#07H
003C 40ED              JC      ?C0005
                                           ; SOURCE LINE # 56
                                           ; SOURCE LINE # 57
003E         ?C0055:
                                           ; SOURCE LINE # 58
003E 020000      R     LJMP    ?C0060
                                           ; SOURCE LINE # 59
                                           ; SOURCE LINE # 60
0041         ?C0006:
                                           ; SOURCE LINE # 62
0041 8DD2              MOV     SIDAT,R5
                                           ; SOURCE LINE # 63
0043 53D4F7            ANL     SICON,#0F7H
                                           ; SOURCE LINE # 64
0046 E4                CLR     A
0047 FA                MOV     R2,A
0048 FB                MOV     R3,A
0049         ?C0008:
                                           ; SOURCE LINE # 65
0049 E5D4              MOV     A,SICON
004B 20E310            JB      ACC.3,?C0009
                                           ; SOURCE LINE # 66
                                           ; SOURCE LINE # 67
004E 0B                INC     R3
004F BB0001            CJNE    R3,#00H,?C0050
0052 0A                INC     R2
0053         ?C0050:
                                           ; SOURCE LINE # 68
0053 D3                SETB    C
0054 EB                MOV     A,R3
0055 94D0              SUBB    A,#0D0H
0057 EA                MOV     A,R2
0058 9407              SUBB    A,#07H
005A 40ED              JC      ?C0008
                                           ; SOURCE LINE # 69
                                           ; SOURCE LINE # 70
005C         ?C0056:
                                           ; SOURCE LINE # 71
005C 807A              SJMP    ?C0060
                                           ; SOURCE LINE # 72
                                           ; SOURCE LINE # 73
005E         ?C0009:
                                           ; SOURCE LINE # 76
005E 43D420            ORL     SICON,#020H
                                           ; SOURCE LINE # 77
0061 53D4F7            ANL     SICON,#0F7H
                                           ; SOURCE LINE # 78
0064 E4                CLR     A
0065 FA                MOV     R2,A
0066 FB                MOV     R3,A
0067         ?C0011:
                                           ; SOURCE LINE # 79
0067 E5D4              MOV     A,SICON
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 8   

0069 20E310            JB      ACC.3,?C0012
                                           ; SOURCE LINE # 80
                                           ; SOURCE LINE # 81
006C 0B                INC     R3
006D BB0001            CJNE    R3,#00H,?C0051
0070 0A                INC     R2
0071         ?C0051:
                                           ; SOURCE LINE # 82
0071 D3                SETB    C
0072 EB                MOV     A,R3
0073 94D0              SUBB    A,#0D0H
0075 EA                MOV     A,R2
0076 9407              SUBB    A,#07H
0078 40ED              JC      ?C0011
                                           ; SOURCE LINE # 83
                                           ; SOURCE LINE # 84
007A         ?C0057:
                                           ; SOURCE LINE # 85
007A 805C              SJMP    ?C0060
                                           ; SOURCE LINE # 86
                                           ; SOURCE LINE # 87
007C         ?C0012:
                                           ; SOURCE LINE # 88
007C 53D4DF            ANL     SICON,#0DFH
                                           ; SOURCE LINE # 90
007F EF                MOV     A,R7
0080 4401              ORL     A,#01H
0082 F5D2              MOV     SIDAT,A
                                           ; SOURCE LINE # 91
0084 53D4F7            ANL     SICON,#0F7H
                                           ; SOURCE LINE # 92
0087 E4                CLR     A
0088 FA                MOV     R2,A
0089 FB                MOV     R3,A
008A         ?C0014:
                                           ; SOURCE LINE # 93
008A E5D4              MOV     A,SICON
008C 20E310            JB      ACC.3,?C0015
                                           ; SOURCE LINE # 94
                                           ; SOURCE LINE # 95
008F 0B                INC     R3
0090 BB0001            CJNE    R3,#00H,?C0052
0093 0A                INC     R2
0094         ?C0052:
                                           ; SOURCE LINE # 96
0094 D3                SETB    C
0095 EB                MOV     A,R3
0096 94D0              SUBB    A,#0D0H
0098 EA                MOV     A,R2
0099 9407              SUBB    A,#07H
009B 40ED              JC      ?C0014
                                           ; SOURCE LINE # 97
                                           ; SOURCE LINE # 98
009D         ?C0058:
                                           ; SOURCE LINE # 99
009D 8039              SJMP    ?C0060
                                           ; SOURCE LINE # 100
                                           ; SOURCE LINE # 101
009F         ?C0015:
                                           ; SOURCE LINE # 103
009F 53D4F7            ANL     SICON,#0F7H
                                           ; SOURCE LINE # 104
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 9   

00A2 E4                CLR     A
00A3 FA                MOV     R2,A
00A4 FB                MOV     R3,A
00A5         ?C0017:
                                           ; SOURCE LINE # 105
00A5 E5D4              MOV     A,SICON
00A7 20E310            JB      ACC.3,?C0018
                                           ; SOURCE LINE # 106
                                           ; SOURCE LINE # 107
00AA 0B                INC     R3
00AB BB0001            CJNE    R3,#00H,?C0053
00AE 0A                INC     R2
00AF         ?C0053:
                                           ; SOURCE LINE # 108
00AF D3                SETB    C
00B0 EB                MOV     A,R3
00B1 94D0              SUBB    A,#0D0H
00B3 EA                MOV     A,R2
00B4 9407              SUBB    A,#07H
00B6 40ED              JC      ?C0017
                                           ; SOURCE LINE # 109
                                           ; SOURCE LINE # 110
00B8         ?C0059:
                                           ; SOURCE LINE # 111
00B8 801E              SJMP    ?C0060
                                           ; SOURCE LINE # 112
                                           ; SOURCE LINE # 113
00BA         ?C0018:
                                           ; SOURCE LINE # 114
00BA AED2              MOV     R6,SIDAT
                                           ; SOURCE LINE # 116
00BC 43D410            ORL     SICON,#010H
                                           ; SOURCE LINE # 117
00BF 53D4F7            ANL     SICON,#0F7H
                                           ; SOURCE LINE # 118
00C2 E4                CLR     A
00C3 FA                MOV     R2,A
00C4 FB                MOV     R3,A
00C5         ?C0020:
                                           ; SOURCE LINE # 119
00C5 E5D4              MOV     A,SICON
00C7 30E411            JNB     ACC.4,TWI0R_End
                                           ; SOURCE LINE # 120
                                           ; SOURCE LINE # 121
00CA 0B                INC     R3
00CB BB0001            CJNE    R3,#00H,?C0054
00CE 0A                INC     R2
00CF         ?C0054:
                                           ; SOURCE LINE # 122
00CF D3                SETB    C
00D0 EB                MOV     A,R3
00D1 94D0              SUBB    A,#0D0H
00D3 EA                MOV     A,R2
00D4 9407              SUBB    A,#07H
00D6 40ED              JC      ?C0020
                                           ; SOURCE LINE # 123
                                           ; SOURCE LINE # 124
00D8         ?C0060:
00D8 750001      R     MOV     TWI0_Err,#01H
                                           ; SOURCE LINE # 125
                                           ; SOURCE LINE # 126
                                           ; SOURCE LINE # 127
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 10  

                                           ; SOURCE LINE # 128
00DB         TWI0R_End:
                                           ; SOURCE LINE # 129
00DB CF                XCH     A,R7
00DC EE                MOV     A,R6
00DD CF                XCH     A,R7
                                           ; SOURCE LINE # 130
00DE         ?C0023:
00DE 22                RET     
             ; FUNCTION _I2C_Read (END)

             ; FUNCTION _I2C_Write (BEGIN)
                                           ; SOURCE LINE # 132
;---- Variable 'Dev_Addr' assigned to Register 'R7' ----
;---- Variable 'ucData' assigned to Register 'R3' ----
;---- Variable 'Reg_Addr' assigned to Register 'R5' ----
                                           ; SOURCE LINE # 133
                                           ; SOURCE LINE # 134
;---- Variable 'cnt' assigned to Register 'DPTR' ----
                                           ; SOURCE LINE # 135
0000 43D420            ORL     SICON,#020H
                                           ; SOURCE LINE # 136
0003 53D4F7            ANL     SICON,#0F7H
                                           ; SOURCE LINE # 137
0006 E4                CLR     A
0007 F583              MOV     DPH,A
0009 F582              MOV     DPL,A
000B         ?C0024:
                                           ; SOURCE LINE # 138
000B E5D4              MOV     A,SICON
000D 20E30E            JB      ACC.3,?C0025
                                           ; SOURCE LINE # 139
                                           ; SOURCE LINE # 140
0010 A3                INC     DPTR
                                           ; SOURCE LINE # 141
0011 D3                SETB    C
0012 E582              MOV     A,DPL
0014 94D0              SUBB    A,#0D0H
0016 E583              MOV     A,DPH
0018 9407              SUBB    A,#07H
001A 40EF              JC      ?C0024
                                           ; SOURCE LINE # 142
                                           ; SOURCE LINE # 143
                                           ; SOURCE LINE # 144
001C 8076              SJMP    ?C0064
                                           ; SOURCE LINE # 145
                                           ; SOURCE LINE # 146
001E         ?C0025:
                                           ; SOURCE LINE # 147
001E 53D4DF            ANL     SICON,#0DFH
                                           ; SOURCE LINE # 149
0021 8FD2              MOV     SIDAT,R7
                                           ; SOURCE LINE # 150
0023 53D4F7            ANL     SICON,#0F7H
                                           ; SOURCE LINE # 151
0026 E4                CLR     A
0027 F583              MOV     DPH,A
0029 F582              MOV     DPL,A
002B         ?C0028:
                                           ; SOURCE LINE # 152
002B E5D4              MOV     A,SICON
002D 20E30E            JB      ACC.3,?C0029
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 11  

                                           ; SOURCE LINE # 153
                                           ; SOURCE LINE # 154
0030 A3                INC     DPTR
                                           ; SOURCE LINE # 155
0031 D3                SETB    C
0032 E582              MOV     A,DPL
0034 94D0              SUBB    A,#0D0H
0036 E583              MOV     A,DPH
0038 9407              SUBB    A,#07H
003A 40EF              JC      ?C0028
                                           ; SOURCE LINE # 156
                                           ; SOURCE LINE # 157
003C         ?C0061:
                                           ; SOURCE LINE # 158
003C 8056              SJMP    ?C0064
                                           ; SOURCE LINE # 159
                                           ; SOURCE LINE # 160
003E         ?C0029:
                                           ; SOURCE LINE # 162
003E 8DD2              MOV     SIDAT,R5
                                           ; SOURCE LINE # 163
0040 53D4F7            ANL     SICON,#0F7H
                                           ; SOURCE LINE # 164
0043 E4                CLR     A
0044 F583              MOV     DPH,A
0046 F582              MOV     DPL,A
0048         ?C0031:
                                           ; SOURCE LINE # 165
0048 E5D4              MOV     A,SICON
004A 20E30E            JB      ACC.3,?C0032
                                           ; SOURCE LINE # 166
                                           ; SOURCE LINE # 167
004D A3                INC     DPTR
                                           ; SOURCE LINE # 168
004E D3                SETB    C
004F E582              MOV     A,DPL
0051 94D0              SUBB    A,#0D0H
0053 E583              MOV     A,DPH
0055 9407              SUBB    A,#07H
0057 40EF              JC      ?C0031
                                           ; SOURCE LINE # 169
                                           ; SOURCE LINE # 170
0059         ?C0062:
                                           ; SOURCE LINE # 171
0059 8039              SJMP    ?C0064
                                           ; SOURCE LINE # 172
                                           ; SOURCE LINE # 173
005B         ?C0032:
                                           ; SOURCE LINE # 175
005B 8BD2              MOV     SIDAT,R3
                                           ; SOURCE LINE # 176
005D 53D4F7            ANL     SICON,#0F7H
                                           ; SOURCE LINE # 177
0060 E4                CLR     A
0061 F583              MOV     DPH,A
0063 F582              MOV     DPL,A
0065         ?C0034:
                                           ; SOURCE LINE # 178
0065 E5D4              MOV     A,SICON
0067 20E30E            JB      ACC.3,?C0035
                                           ; SOURCE LINE # 179
                                           ; SOURCE LINE # 180
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 12  

006A A3                INC     DPTR
                                           ; SOURCE LINE # 181
006B D3                SETB    C
006C E582              MOV     A,DPL
006E 94D0              SUBB    A,#0D0H
0070 E583              MOV     A,DPH
0072 9407              SUBB    A,#07H
0074 40EF              JC      ?C0034
                                           ; SOURCE LINE # 182
                                           ; SOURCE LINE # 183
0076         ?C0063:
                                           ; SOURCE LINE # 184
0076 801C              SJMP    ?C0064
                                           ; SOURCE LINE # 185
                                           ; SOURCE LINE # 186
0078         ?C0035:
                                           ; SOURCE LINE # 188
0078 43D410            ORL     SICON,#010H
                                           ; SOURCE LINE # 189
007B 53D4F7            ANL     SICON,#0F7H
                                           ; SOURCE LINE # 190
007E E4                CLR     A
007F F583              MOV     DPH,A
0081 F582              MOV     DPL,A
0083         ?C0037:
                                           ; SOURCE LINE # 191
0083 E5D4              MOV     A,SICON
0085 30E40F            JNB     ACC.4,TWI0W_End
                                           ; SOURCE LINE # 192
                                           ; SOURCE LINE # 193
0088 A3                INC     DPTR
                                           ; SOURCE LINE # 194
0089 D3                SETB    C
008A E582              MOV     A,DPL
008C 94D0              SUBB    A,#0D0H
008E E583              MOV     A,DPH
0090 9407              SUBB    A,#07H
0092 40EF              JC      ?C0037
                                           ; SOURCE LINE # 195
                                           ; SOURCE LINE # 196
0094         ?C0064:
0094 750001      R     MOV     TWI0_Err,#01H
                                           ; SOURCE LINE # 197
                                           ; SOURCE LINE # 198
                                           ; SOURCE LINE # 199
                                           ; SOURCE LINE # 200
0097         TWI0W_End:
                                           ; SOURCE LINE # 201
0097 00                NOP     
                                           ; SOURCE LINE # 202
0098 22                RET     
             ; FUNCTION _I2C_Write (END)

             ; FUNCTION Timer0_Initial (BEGIN)
                                           ; SOURCE LINE # 204
                                           ; SOURCE LINE # 205
                                           ; SOURCE LINE # 206
0000 758902            MOV     TMOD,#02H
                                           ; SOURCE LINE # 207
0003 758CEC            MOV     TH0,#0ECH
                                           ; SOURCE LINE # 208
0006 758AEC            MOV     TL0,#0ECH
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 13  

                                           ; SOURCE LINE # 209
0009 D28C              SETB    TR0
                                           ; SOURCE LINE # 210
000B 75A304            MOV     AUXR2,#04H
                                           ; SOURCE LINE # 212
000E 22                RET     
             ; FUNCTION Timer0_Initial (END)

             ; FUNCTION TWI0_Init (BEGIN)
                                           ; SOURCE LINE # 214
                                           ; SOURCE LINE # 215
                                           ; SOURCE LINE # 216
0000 E4                CLR     A
0001 F5D4              MOV     SICON,A
                                           ; SOURCE LINE # 218
0003 439514            ORL     P2M0,#014H
                                           ; SOURCE LINE # 219
0006 75AC01            MOV     SFRPI,#01H
                                           ; SOURCE LINE # 220
0009 E592              MOV     A,P2M1
000B 4414              ORL     A,#014H
000D F595              MOV     P2M0,A
                                           ; SOURCE LINE # 221
000F E4                CLR     A
0010 F5AC              MOV     SFRPI,A
                                           ; SOURCE LINE # 222
0012 00                NOP     
                                           ; SOURCE LINE # 223
0013 00                NOP     
                                           ; SOURCE LINE # 224
0014 00                NOP     
                                           ; SOURCE LINE # 225
0015 75A406            MOV     AUXR3,#06H
                                           ; SOURCE LINE # 226
0018 75D4C3            MOV     SICON,#0C3H
                                           ; SOURCE LINE # 227
001B 22                RET     
             ; FUNCTION TWI0_Init (END)

             ; FUNCTION main (BEGIN)
                                           ; SOURCE LINE # 229
                                           ; SOURCE LINE # 230
                                           ; SOURCE LINE # 231
0000 120000      R     LCALL   Timer0_Initial
                                           ; SOURCE LINE # 232
0003 120000      R     LCALL   TWI0_Init
0006         ?C0043:
                                           ; SOURCE LINE # 235
                                           ; SOURCE LINE # 236
                                           ; SOURCE LINE # 237
0006 E4                CLR     A
0007 F500        R     MOV     TWI0_Err,A
                                           ; SOURCE LINE # 238
0009 7BA5              MOV     R3,#0A5H
000B 7DAA              MOV     R5,#0AAH
000D 7FA0              MOV     R7,#0A0H
000F 120000      R     LCALL   _I2C_Write
                                           ; SOURCE LINE # 239
0012 E500        R     MOV     A,TWI0_Err
0014 6003              JZ      ?C0045
                                           ; SOURCE LINE # 240
                                           ; SOURCE LINE # 241
C51 COMPILER V9.52.0.0   MAIN                                                              02/06/2018 17:04:01 PAGE 14  

0016 120000      R     LCALL   TWI0_Init
                                           ; SOURCE LINE # 242
0019         ?C0045:
                                           ; SOURCE LINE # 243
0019 7F05              MOV     R7,#05H
001B 7E00              MOV     R6,#00H
001D 120000      E     LCALL   _delay_ms
                                           ; SOURCE LINE # 245
0020 E4                CLR     A
0021 F500        R     MOV     TWI0_Err,A
                                           ; SOURCE LINE # 246
0023 7DAA              MOV     R5,#0AAH
0025 7FA0              MOV     R7,#0A0H
0027 120000      R     LCALL   _I2C_Read
002A 8F00        R     MOV     tmp,R7
                                           ; SOURCE LINE # 247
002C E500        R     MOV     A,TWI0_Err
002E 6003              JZ      ?C0046
                                           ; SOURCE LINE # 248
                                           ; SOURCE LINE # 249
0030 120000      R     LCALL   TWI0_Init
                                           ; SOURCE LINE # 250
0033         ?C0046:
                                           ; SOURCE LINE # 251
0033 7F05              MOV     R7,#05H
0035 7E00              MOV     R6,#00H
0037 120000      E     LCALL   _delay_ms
                                           ; SOURCE LINE # 253
003A 80CA              SJMP    ?C0043
             ; FUNCTION main (END)



MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    479    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      2    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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