C51 COMPILER V9.54   MAIN                                                                  04/26/2022 17:02:02 PAGE 1   


C51 COMPILER V9.54, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\Objects\main.obj
COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE source\main.c OPTIMIZE(8,SPEED) BROWSE DEBUG OBJECTEXTEND PRINT(.\Listin
                    -gs\main.lst) TABS(2) OBJECT(.\Objects\main.obj)

line level    source

   1          
   2          /******************** (C) COPYRIGHT 2021 SONiX *******************************
   3          * COMPANY:  SONiX
   4          * DATE:   2022/04/25
   5          * AUTHOR:   Eden
   6          * IC:     SN8F5835
   7          *____________________________________________________________________________
   8          * REVISION    Date        User    Description
   9          * 1.0         2022/04/25  Eden    1. First release
  10          *____________________________________________________________________________
  11          *****************************************************************************/
  12          
  13          
  14          
  15          
  16          
  17          /*_____ I N C L U D E S _________________________________*/
  18          #define __XRAM_SFR_H__
  19          #include <SN8F5835.h>
  20          #include "pwm.h"
  21          /*_____ F U N C T I O N S _______________________________*/
  22          
  23          void PWM_InitializePwm30(uint16_t pwm30_period,uint8_t pwm30_percentage);
  24          void PWM_InitializePwm31(uint16_t pwm31_period,uint8_t pwm31_percentage);
  25          void PWM_InitializePwm32(uint16_t pwm32_period,uint8_t pwm32_percentage);
  26          void PWM_InitializePwm33(uint16_t pwm33_period,uint8_t pwm33_percentage);
  27          void GPIO_Initialization(void);
  28          
  29          /*_____ D E F I N I T I O N S ___________________________*/
  30          
  31          /*_____ D E C L A R A T I O N S _________________________*/
  32          
  33          
  34          
  35          /*_____ M A C R O S _____________________________________*/
  36          #define    IO_PORT0_OUTPUT_LOW        P0M |= 0xFF;    P0 &= 0x00;
  37          #define    IO_PORT1_OUTPUT_LOW        P1M |= 0xFF;    P1 &= 0xFF;
  38          #define    IO_PORT3_OUTPUT_LOW        P3M |= 0xFF;    P3 &= 0x00;
  39          #define    IO_PORT4_OUTPUT_LOW        P4M |= 0xFF;    P4 &= 0x00;
  40          
  41          /**
  42           *  @Brief    main: PWM2 Demo Function
  43           *  @param    None
  44           *  @return   None
  45           */
  46          
  47          void main(void)
  48          {
  49   1        /*
  50   1         *  System initial:
  51   1         *  (1) GPIO
  52   1         *  Pwm App Fuction:
  53   1         *  (2) PWM30   (Period[n*100us],duty percentage)
  54   1         *  (3) PWM31   (Period[n*100us],duty percentage)
C51 COMPILER V9.54   MAIN                                                                  04/26/2022 17:02:02 PAGE 2   

  55   1         *  (4) PWM32   (Period[n*100us],duty percentage)
  56   1         *  (5) PWM33   (Period[n*100us],duty percentage)
  57   1         */ 
  58   1          GPIO_Initialization();                                                  /*  (1) */
  59   1          PWM_InitializePwm30(10,75);                                             /*  (2) */
  60   1          PWM_InitializePwm31(10,40);                                             /*  (3) */
  61   1          PWM_InitializePwm32(20,33);                                             /*  (4) */
  62   1          PWM_InitializePwm33(25,75);                                             /*  (5) */
  63   1      
  64   1          while(1)
  65   1          {
  66   2        /*  
  67   2         *  (1) Clear Watchdog Timer
  68   2         *  Use Oscilloscope To Check the PWM Duty
  69   2         *   
  70   2         */
  71   2            WDTR = 0x5A;                                                          /*  (1) */
  72   2          }
  73   1      }
  74          
  75          
  76          
  77          /**
  78           *  @Brief    initial GPIO status
  79           *  @param    None
  80           *  @return   None
  81           */
  82          
  83          void GPIO_Initialization(void)
  84          {     
  85   1          IO_PORT0_OUTPUT_LOW
  86   1          IO_PORT1_OUTPUT_LOW
  87   1          IO_PORT3_OUTPUT_LOW
  88   1          IO_PORT4_OUTPUT_LOW
  89   1      }
  90          
  91          /**
  92           *  @Brief    PWM_ExecutePwm30Init: initial PWM30 Function
  93           *  @param    pwm30_period,pwm30_percentage
  94           *  @return   None
  95           */
  96          void PWM_InitializePwm30(uint16_t pwm30_period,uint8_t pwm30_percentage)
  97          { 
  98   1        /*  
  99   1         *  (1) Set PWM3 Period 
 100   1         *  (2) Set PWM3 Period
 101   1         *  (3) Set PWM30 Duty
 102   1         *  (4) Set PWM30 Duty 
 103   1         *  (5) Set PWM3 Freq Division and PWM30 As PWM Channel
 104   1         *  (6) PWM3 Enable 
 105   1         *   
 106   1         */
 107   1          PW3YH = ((pwm30_period*25)&0xFF00)>>8;                                  /*  (1) */  
 108   1          PW3YL = ((pwm30_period*25)&0xFF);                                       /*  (2) */  
 109   1          PW30DH  = (uint16_t) (pwm30_period*pwm30_percentage)>>10;               /*  (3) */
 110   1          PW30DL  = (uint16_t) (pwm30_period*pwm30_percentage)>>2;                /*  (4) */
 111   1          PW3M  |=  (mskPW3M_PWM3_DIV128|mskPW3CH_PW3CH0);                        /*  (5) */
 112   1          PW3M  |=  mskPW3M_PW3EN;                                                /*  (6) */
 113   1      }
 114          
 115          
 116          /**
C51 COMPILER V9.54   MAIN                                                                  04/26/2022 17:02:02 PAGE 3   

 117           *  @Brief    PWM_ExecutePwm31Init: initial PWM31 Function
 118           *  @param    pwm31_period,pwm11_percentage
 119           *  @return   None
 120           */
 121          void PWM_InitializePwm31(uint16_t pwm31_period,uint8_t pwm31_percentage)
 122          {
 123   1        /*  
 124   1         *  (1) Set PWM3 Period 
 125   1         *  (2) Set PWM3 Period
 126   1         *  (3) Set PWM31 Duty
 127   1         *  (4) Set PWM31 Duty 
 128   1         *  (5) Set PWM3 Freq Division and PWM31 As PWM Channel
 129   1         *  (6) PWM3 Enable 
 130   1         *   
 131   1         */
 132   1          PW3YH = ((pwm31_period*25)&0xFF00)>>8;                                  /*  (1) */  
 133   1          PW3YL = ((pwm31_period*25)&0xFF);                                       /*  (2) */  
 134   1          PW31DH  = (uint16_t) (pwm31_period*pwm31_percentage)>>10;               /*  (3) */
 135   1          PW31DL  = (uint16_t) (pwm31_period*pwm31_percentage)>>2;                /*  (4) */
 136   1          PW3M  |=  (mskPW3M_PWM3_DIV128|mskPW3CH_PW3CH1);                        /*  (5) */
 137   1          PW3M  |=  mskPW3M_PW3EN;                                                /*  (6) */  
 138   1      }
 139          
 140          /**
 141           *  @Brief    PWM_ExecutePwm32Init: initial PWM32 Function
 142           *  @param    pwm32_period,pwm32_percentage
 143           *  @return   None
 144           */
 145          void PWM_InitializePwm32(uint16_t pwm32_period,uint8_t pwm32_percentage)
 146          {
 147   1        /*  
 148   1         *  (1) Set PWM3 Period 
 149   1         *  (2) Set PWM3 Period
 150   1         *  (3) Set PWM32 Duty
 151   1         *  (4) Set PWM32 Duty 
 152   1         *  (5) Set PWM3 Freq Division and PWM32 As PWM Channel
 153   1         *  (6) PWM3 Enable 
 154   1         *   
 155   1         */
 156   1          PW3YH = ((pwm32_period*25)&0xFF00)>>8;                                  /*  (1) */  
 157   1          PW3YL = ((pwm32_period*25)&0xFF);                                       /*  (2) */  
 158   1          PW32DH  = (uint16_t) (pwm32_period*pwm32_percentage)>>10;               /*  (3) */
 159   1          PW32DL  = (uint16_t) (pwm32_period*pwm32_percentage)>>2;                /*  (4) */
 160   1          PW3M  |=  (mskPW3M_PWM3_DIV128|mskPW3CH_PW3CH2);                        /*  (5) */
 161   1          PW3M  |=  mskPW3M_PW3EN;                                                /*  (6) */                                                /*  (6) */  
 162   1      }
 163          
 164          /**
 165           *  @Brief    PWM_ExecutePwm33Init: initial PWM33 Function
 166           *  @param    pwm33_period,pwm13_percentage
 167           *  @return   None
 168           */
 169          void PWM_InitializePwm33(uint16_t pwm33_period,uint8_t pwm33_percentage)
 170          {
 171   1        /*  
 172   1         *  (1) Set PWM3 Period 
 173   1         *  (2) Set PWM3 Period
 174   1         *  (3) Set PWM33 Duty
 175   1         *  (4) Set PWM33 Duty 
 176   1         *  (5) Set PWM3 Freq Division and PWM33 As PWM Channel
 177   1         *  (6) PWM3 Enable 
 178   1         *   
C51 COMPILER V9.54   MAIN                                                                  04/26/2022 17:02:02 PAGE 4   

 179   1         */
 180   1          PW3YH = ((pwm33_period*25)&0xFF00)>>8;                                  /*  (1) */  
 181   1          PW3YL = ((pwm33_period*25)&0xFF);                                       /*  (2) */  
 182   1          PW33DH  = (uint16_t) (pwm33_period*pwm33_percentage)>>10;               /*  (3) */
 183   1          PW33DL  = (uint16_t) (pwm33_period*pwm33_percentage)>>2;                /*  (4) */
 184   1          PW3M  |=  (mskPW3M_PWM3_DIV128|mskPW3CH_PW3CH3);                        /*  (5) */
 185   1          PW3M  |=  mskPW3M_PW3EN;                                                /*  (6) */                                                /*  (6) */  
 186   1      }
 187          


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


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