C51 COMPILER V8.02   MAIN                                                                  01/09/2018 11:08:16 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          
   3          #include "REG_MA82G5Dxx.H"
   4          #include "delay.h"
   5          
   6          
   7          #define         AFS                                             0x80
   8          #define         SMOD1                                   0x80
   9          #define         T1X12                                   0x08
  10          
  11          #define         ADCEN                                   0x80
  12          #define         ADCI                                    0x10
  13          #define         ADCS                                    0x08
  14          #define         CHS2                                    0x04
  15          #define         CHS1                                    0x02
  16          #define         CHS0                                    0x01
  17          
  18          unsigned char Value_ADCH;
  19          
  20          void Initial_ADC(void)
  21          {
  22   1              ADCON0 = ADCEN;
  23   1              delay_50us();
  24   1      
  25   1      }
  26          
  27          
  28          
  29          void ADC_Start(void)
  30          {
  31   1              ADCON0 |= 0x08;                                         //start AD conversion
  32   1              while(!(ADCON0 & 0x10));                        //wait AD conversion finish
  33   1              ADCON0 &= 0xEF;                                         //Clear ADC interrupt flag
  34   1              
  35   1              Value_ADCH = ADCDH;
  36   1      }
  37          
  38          void Initlal_PCA5(void)
  39          {
  40   1      
  41   1              CCAPM5 = 0x42;                                                          //set 8bit PWM
  42   1              CCAP5H = 0x80;                                                          //duty cycle = 50%
  43   1              PCAPWM5=0x00;
  44   1              CMOD = 0x02;                                                            //CPS2 ~ CPS0 = 0, 0, 1. (sysclk) / 2
  45   1              CCON = 0x40;                                                            //PCA run, 12MHz / 2 / 256 = 23.4KHz.
  46   1              P3M0 = P3M0&(~P3M05);                                           //CEX5(P35) push pull 
  47   1              P3M1 = P3M1|(P3M15);;
  48   1      }
  49          
  50          
  51          void main(void)
  52          {
  53   1      
  54   1      
  55   1              Initlal_PCA5();
C51 COMPILER V8.02   MAIN                                                                  01/09/2018 11:08:16 PAGE 2   

  56   1              Initial_ADC();
  57   1      
  58   1      
  59   1              while(1){
  60   2                      ADC_Start();
  61   2                      CCAP5H = ~Value_ADCH;
  62   2                      delay_ms(1);
  63   2                      
  64   2              }
  65   1      }


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


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