C51 COMPILER V8.02   MAIN                                                                  01/16/2018 10:49:12 PAGE 1   


C51 COMPILER V8.02, 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

line level    source

   1          
   2          #define         uCHAR   unsigned char
   3          #define         uINT    unsigned int
   4          
   5          #include "REG_MA82G5Dxx.H"
   6          
   7          #define         URTS                            0x80
   8          #define         SMOD2                           0x40
   9          #define         S1TR                            0x10
  10          #define         S1MOD                           0x08
  11          #define         S1X12                           0x04
  12          #define         MCKS1                           0x08
  13          #define         MCKS0                           0x04
  14          
  15          #define         AFS                                     0x80
  16          #define         CKCON2                          0x40
  17          
  18          #define         ISP_ENABLE                      0x80
  19          #define         ISP_DISABLE                     0x00
  20          
  21          uCHAR tmp;
  22          
  23          uCHAR ESF_Flag;
  24          
  25          
  26          void PageP_Write( uCHAR Addr , uCHAR Data )
  27          {
  28   1              IFADRH = 0x00;
  29   1              IFADRL = Addr;
  30   1              IFD = Data;
  31   1              IFMT = 0x04;
  32   1              ISPCR = ISP_ENABLE;
  33   1              SCMD = 0x46;
  34   1              SCMD = 0xB9;
  35   1              ISPCR = ISP_DISABLE;
  36   1      }
  37          
  38          uCHAR PageP_Read(uCHAR  Addr)
  39          {
  40   1              uCHAR   Data;
  41   1      
  42   1              IFADRH = 0x00;
  43   1              IFADRL = Addr;
  44   1              IFMT = 0x05;
  45   1              ISPCR = ISP_ENABLE;
  46   1              SCMD = 0x46;
  47   1              SCMD = 0xB9;
  48   1              ISPCR = ISP_DISABLE;
  49   1              Data = IFD;
  50   1              
  51   1              return Data;
  52   1      }
  53          
  54          
  55          
C51 COMPILER V8.02   MAIN                                                                  01/16/2018 10:49:12 PAGE 2   

  56          void Stop_WDT(void)
  57          {
  58   1              tmp = ENW | CLRW |PS2 |PS1 |PS0;
  59   1              PageP_Write(0xE1, tmp);                 //WDTCR is 0xE1.
  60   1      }
  61          
  62          void Start_WDT(void)
  63          {
  64   1              WDTCR = (NSW | ENW | CLRW |PS2 |PS1 |PS0);              // wdt time=2s
  65   1      }
  66          
  67          void Initial_WDT(void)
  68          {
  69   1              PCON1 |= WDTF;                  //clear WDTF
  70   1              Start_WDT();
  71   1              EIE1 |= ESF;                    //enable interrupt
  72   1              SFIE |= WDTFIE;
  73   1      }
  74          
  75          void INT_SYS(void)      interrupt       10      using   1
  76          {
  77   1              PCON1 |= WDTF;                  //clear WDTF
  78   1              ESF_Flag = 1;                   //set ESF flag
  79   1      
  80   1      }
  81          
  82          void main(void)
  83          {
  84   1          Initial_WDT();
  85   1              EA = 1;
  86   1              
  87   1              P1 = 0x00;
  88   1              P2 = 0x00;
  89   1              P3 = 0x00;
  90   1              P4 = 0x00;
  91   1              P6 = 0x00;
  92   1              
  93   1      
  94   1              while(1)
  95   1              {
  96   2                      if(ESF_Flag)
  97   2                      {
  98   3                              ESF_Flag = 0;
  99   3                              // to do...
 100   3                              P30 = ~P30;
 101   3                      }
 102   2                      
 103   2                      PCON0 = 0x02;
 104   2              }
 105   1      }
C51 COMPILER V8.02   MAIN                                                                  01/16/2018 10:49:12 PAGE 3   

ASSEMBLY LISTING OF GENERATED OBJECT CODE


             ; FUNCTION _PageP_Write (BEGIN)
                                           ; SOURCE LINE # 26
;---- Variable 'Data' assigned to Register 'R5' ----
;---- Variable 'Addr' assigned to Register 'R7' ----
                                           ; SOURCE LINE # 27
                                           ; SOURCE LINE # 28
0000 E4                CLR     A
0001 F5E3              MOV     IFADRH,A
                                           ; SOURCE LINE # 29
0003 8FE4              MOV     IFADRL,R7
                                           ; SOURCE LINE # 30
0005 8DE2              MOV     IFD,R5
                                           ; SOURCE LINE # 31
0007 75E504            MOV     IFMT,#04H
                                           ; SOURCE LINE # 32
000A 75E780            MOV     ISPCR,#080H
                                           ; SOURCE LINE # 33
000D 75E646            MOV     SCMD,#046H
                                           ; SOURCE LINE # 34
0010 75E6B9            MOV     SCMD,#0B9H
                                           ; SOURCE LINE # 35
0013 F5E7              MOV     ISPCR,A
                                           ; SOURCE LINE # 36
0015 22                RET     
             ; FUNCTION _PageP_Write (END)

             ; FUNCTION _PageP_Read (BEGIN)
                                           ; SOURCE LINE # 38
;---- Variable 'Addr' assigned to Register 'R7' ----
                                           ; SOURCE LINE # 39
                                           ; SOURCE LINE # 42
0000 E4                CLR     A
0001 F5E3              MOV     IFADRH,A
                                           ; SOURCE LINE # 43
0003 8FE4              MOV     IFADRL,R7
                                           ; SOURCE LINE # 44
0005 75E505            MOV     IFMT,#05H
                                           ; SOURCE LINE # 45
0008 75E780            MOV     ISPCR,#080H
                                           ; SOURCE LINE # 46
000B 75E646            MOV     SCMD,#046H
                                           ; SOURCE LINE # 47
000E 75E6B9            MOV     SCMD,#0B9H
                                           ; SOURCE LINE # 48
0011 F5E7              MOV     ISPCR,A
                                           ; SOURCE LINE # 49
;---- Variable 'Data' assigned to Register 'R7' ----
0013 AFE2              MOV     R7,IFD
                                           ; SOURCE LINE # 51
                                           ; SOURCE LINE # 52
0015         ?C0002:
0015 22                RET     
             ; FUNCTION _PageP_Read (END)

             ; FUNCTION Stop_WDT (BEGIN)
                                           ; SOURCE LINE # 56
                                           ; SOURCE LINE # 57
                                           ; SOURCE LINE # 58
0000 750037      R     MOV     tmp,#037H
C51 COMPILER V8.02   MAIN                                                                  01/16/2018 10:49:12 PAGE 4   

                                           ; SOURCE LINE # 59
0003 AD00        R     MOV     R5,tmp
0005 7FE1              MOV     R7,#0E1H
0007 020000      R     LJMP    _PageP_Write
             ; FUNCTION Stop_WDT (END)

             ; FUNCTION Start_WDT (BEGIN)
                                           ; SOURCE LINE # 62
                                           ; SOURCE LINE # 63
                                           ; SOURCE LINE # 64
0000 75E177            MOV     WDTCR,#077H
                                           ; SOURCE LINE # 65
0003 22                RET     
             ; FUNCTION Start_WDT (END)

             ; FUNCTION Initial_WDT (BEGIN)
                                           ; SOURCE LINE # 67
                                           ; SOURCE LINE # 68
                                           ; SOURCE LINE # 69
0000 439701            ORL     PCON1,#01H
                                           ; SOURCE LINE # 70
0003 120000      R     LCALL   Start_WDT
                                           ; SOURCE LINE # 71
0006 43AD08            ORL     EIE1,#08H
                                           ; SOURCE LINE # 72
0009 438E01            ORL     SFIE,#01H
                                           ; SOURCE LINE # 73
000C 22                RET     
             ; FUNCTION Initial_WDT (END)

             ; FUNCTION INT_SYS (BEGIN)
                                           ; SOURCE LINE # 75
                                           ; SOURCE LINE # 77
0000 439701            ORL     PCON1,#01H
                                           ; SOURCE LINE # 78
0003 750001      R     MOV     ESF_Flag,#01H
                                           ; SOURCE LINE # 80
0006 32                RETI    
             ; FUNCTION INT_SYS (END)

             ; FUNCTION main (BEGIN)
                                           ; SOURCE LINE # 82
                                           ; SOURCE LINE # 83
                                           ; SOURCE LINE # 84
0000 120000      R     LCALL   Initial_WDT
                                           ; SOURCE LINE # 85
0003 D2AF              SETB    EA
                                           ; SOURCE LINE # 87
0005 E4                CLR     A
0006 F590              MOV     P1,A
                                           ; SOURCE LINE # 88
0008 F5A0              MOV     P2,A
                                           ; SOURCE LINE # 89
000A F5B0              MOV     P3,A
                                           ; SOURCE LINE # 90
000C F5E8              MOV     P4,A
                                           ; SOURCE LINE # 91
000E F5F8              MOV     P6,A
0010         ?C0007:
                                           ; SOURCE LINE # 94
                                           ; SOURCE LINE # 95
                                           ; SOURCE LINE # 96
C51 COMPILER V8.02   MAIN                                                                  01/16/2018 10:49:12 PAGE 5   

0010 E500        R     MOV     A,ESF_Flag
0012 6005              JZ      ?C0009
                                           ; SOURCE LINE # 97
                                           ; SOURCE LINE # 98
0014 E4                CLR     A
0015 F500        R     MOV     ESF_Flag,A
                                           ; SOURCE LINE # 100
0017 B2B0              CPL     P30
                                           ; SOURCE LINE # 101
0019         ?C0009:
                                           ; SOURCE LINE # 103
0019 758702            MOV     PCON0,#02H
                                           ; SOURCE LINE # 104
001C 80F2              SJMP    ?C0007
             ; FUNCTION main (END)



MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    108    ----
   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)
