C51 COMPILER V8.02   MAIN                                                                  01/16/2018 10:33:28 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

line level    source

   1          
   2          #define         uCHAR   unsigned char
   3          #define         BYTE    unsigned char
   4          #define         uINT    unsigned int
   5          
   6          #include "REG_MA82G5Dxx.H"
   7          
   8          #define         T2X12                           0x10
   9          
  10          #define         URTS                            0x80
  11          #define         SMOD2                           0x40
  12          #define         S1TR                            0x10
  13          #define         S1MOD                           0x08
  14          #define         S1X12                           0x04
  15          #define         MCKS1                           0x08
  16          #define         MCKS0                           0x04
  17          
  18          #define         AFS                                     0x80
  19          #define         CKCON2                          0x40
  20          
  21          #define         ISP_ENABLE                      0x80
  22          #define         ISP_DISABLE                     0x00
  23          
  24          uCHAR flag_Tx0_Busy;
  25          uCHAR i;
  26          uCHAR tmp;
  27          uCHAR UID_Code[16];
  28          
  29          
  30          void INT_UART0(void) interrupt 4
  31          {
  32   1              if(RI0){
  33   2                      RI0 = 0;
  34   2                      
  35   2              }else if(TI0)
  36   1              {
  37   2                      TI0 = 0;
  38   2                      if(flag_Tx0_Busy == 1)
  39   2                              flag_Tx0_Busy = 0;
  40   2              }
  41   1      }
  42          
  43          
  44          void Initial_UART0(void)                //MCU Run 11.0592MHz, Baud Rate is 9600bps.
  45          {
  46   1              S0CON = 0x50;
  47   1              T2CON = 0x30;
  48   1              T2MOD = T2X12;
  49   1              RCAP2H = 0xFF;
  50   1              RCAP2L = 0xB8;                          //if you want to change Baud Rate, you can refer to Table 17-16 right in Spec.
  51   1              TH2 = 0xFF;
  52   1              TL2 = 0xB8;
  53   1              TR2 = 1;
  54   1              PCON0 |= 0x80;                                          //SMOD1 = 1;
  55   1      }
C51 COMPILER V8.02   MAIN                                                                  01/16/2018 10:33:28 PAGE 2   

  56          
  57          void UART0_Send_Byte(uCHAR dta)
  58          {
  59   1              SFRPI = 0x00;
  60   1              S0BUF = dta;
  61   1              flag_Tx0_Busy = 1;
  62   1              while(flag_Tx0_Busy);
  63   1      }
  64          
  65          void UART0_Show_UID(void)
  66          {
  67   1              ISPCR = ISP_ENABLE;
  68   1              BOREV = 0x22;
  69   1              IFMT = 0x06;
  70   1              IFADRH = 0x00;
  71   1              IFADRL = 0xF0;
  72   1              
  73   1              for(i = 0; i < 16; i ++)
  74   1              {
  75   2                      SCMD = 0x46;
  76   2                      SCMD = 0xB9;
  77   2                      UID_Code[i] = IFD;
  78   2                      UART0_Send_Byte(IFD);                                   //Get Unique ID
  79   2                      IFADRL ++;
  80   2              }
  81   1              BOREV = 0x00;
  82   1              IFMT=0;
  83   1              ISPCR = ISP_DISABLE;
  84   1      }
  85          
  86          
  87          void main(void)
  88          {
  89   1              CKCON0 |= AFS;                          //MCU Run 11.0592MHz,
  90   1              Initial_UART0();
  91   1              ES0 = 1;
  92   1              EA = 1;
  93   1      
  94   1              
  95   1              UART0_Show_UID();
  96   1      
  97   1              
  98   1              while(1);
  99   1      }


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


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