C51 COMPILER V8.01   MAIN                                                                  09/05/2017 17:40:44 PAGE 1   


C51 COMPILER V8.01, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil_uv3\C51\BIN\C51.EXE main.c BROWSE NOAREGS DEBUG OBJECTEXTEND

line level    source

   1          
   2          #define         uCHAR   unsigned char
   3          #define         uINT    unsigned int
   4          
   5          #include "REG_MA82G5Dxx.H"
   6          
   7          
   8          #define    ISP_ENABLE          0x80              // Set ISP Enable
   9          #define    ISP_DISABLE         0x00              // Set ISP Disable
  10          
  11          uCHAR IAP_Var0;
  12          uCHAR IAP_Var1;
  13          uCHAR IAP_Var2;
  14          uCHAR IAP_Var3;
  15          
  16          void PageP_Write( uCHAR Addr , uCHAR Data )
  17          {
  18   1              IFADRH = 0x00;
  19   1              IFADRL = Addr;
  20   1              IFD = Data;
  21   1              IFMT = 0x04;
  22   1              ISPCR = ISP_ENABLE;
  23   1              SCMD = 0x46;
  24   1              SCMD = 0xB9;
  25   1              ISPCR = ISP_DISABLE;
  26   1      }
  27          
  28          uCHAR PageP_Read(uCHAR  Addr)
  29          {
  30   1              uCHAR   Data;
  31   1      
  32   1              ISPCR = ISP_ENABLE;
  33   1          IFADRH = 0x00;
  34   1          IFADRL = Addr;
  35   1          IFMT = 0x05;
  36   1          SCMD = 0x46;
  37   1          SCMD = 0xB9;
  38   1              Data = IFD;
  39   1          ISPCR = ISP_DISABLE;
  40   1              
  41   1              return Data;
  42   1      }
  43          
  44          
  45          void IAP_Erase(uCHAR AddrH, uCHAR AddrL)
  46          {
  47   1              IFADRH = AddrH;
  48   1              IFADRL = AddrL;
  49   1              IFMT = 0x03;                                                            //erase
  50   1              ISPCR = ISP_ENABLE;
  51   1          SCMD = 0x46;
  52   1          SCMD = 0xB9;
  53   1          ISPCR = ISP_DISABLE;
  54   1      }
  55          
C51 COMPILER V8.01   MAIN                                                                  09/05/2017 17:40:44 PAGE 2   

  56          void IAP_Program(uCHAR AddrH, uCHAR AddrL, uCHAR Dta)
  57          {
  58   1              IFADRH = AddrH;
  59   1              IFADRL = AddrL;
  60   1              IFD = Dta;
  61   1              IFMT = 0x02;                                                            //program
  62   1              ISPCR = ISP_ENABLE;
  63   1          SCMD = 0x46;
  64   1          SCMD = 0xB9;
  65   1          ISPCR = ISP_DISABLE;
  66   1      }
  67          
  68          uCHAR IAP_Read(uCHAR AddrH, uCHAR AddrL)
  69          {
  70   1              uCHAR Dta;
  71   1      
  72   1              IFADRH = AddrH;
  73   1              IFADRL = AddrL;
  74   1              IFMT = 0x01;                                                            //read
  75   1              ISPCR = ISP_ENABLE;
  76   1          SCMD = 0x46;
  77   1          SCMD = 0xB9;
  78   1          ISPCR = ISP_DISABLE;
  79   1      
  80   1              Dta = IFD;
  81   1              return Dta;
  82   1      }
  83          
  84          void main()
  85          {
  86   1              uCHAR tmp;
  87   1              CKCON1 = 0x0B;                                                  //OSCin = 12MHz
  88   1              
  89   1              tmp = PageP_Read(IAPLB_P);
  90   1              
  91   1              PageP_Write(IAPLB_P, 0x10);                             //set IAPLB address at 0x1000
  92   1      
  93   1              IAP_Erase(0x10, 0x00);
  94   1              IAP_Program(0x10, 0x00, 0x55);
  95   1              IAP_Program(0x10, 0x01, 0xAA);
  96   1              IAP_Program(0x10, 0x02, 0x5A);
  97   1              IAP_Program(0x10, 0x03, 0xA5);
  98   1      
  99   1              IAP_Var0 = IAP_Read(0x10, 0x00);
 100   1              IAP_Var1 = IAP_Read(0x10, 0x01);
 101   1              IAP_Var2 = IAP_Read(0x10, 0x02);
 102   1              IAP_Var3 = IAP_Read(0x10, 0x03);
 103   1      
 104   1              while(1);
 105   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    185    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      4       1
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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