C51 COMPILER V9.54   MAIN                                                                  05/06/2022 16:40: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 2022 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          /*_____ I N C L U D E S _________________________________*/
  16          #define __XRAM_SFR_H__
  17          #include <SN8F5835.h>
  18          #include "pwm.h"
  19          /*_____ F U N C T I O N S _______________________________*/
  20          
  21          void PWM_InitializePwm10(uint16_t pwm10_period,uint8_t pwm10_percentage);
  22          void PWM_InitializePwm11(uint16_t pwm11_period,uint8_t pwm11_percentage);
  23          void PWM_InitializePwm12(uint16_t pwm12_period,uint8_t pwm12_percentage);
  24          void PWM_InitializePwm13(uint16_t pwm13_period,uint8_t pwm13_percentage);
  25          void GPIO_Initialization(void);
  26          
  27          /*_____ D E F I N I T I O N S ___________________________*/
  28          
  29          /*_____ D E C L A R A T I O N S _________________________*/
  30          
  31          
  32          
  33          /*_____ M A C R O S _____________________________________*/
  34          #define    IO_PORT0_OUTPUT_LOW        P0M |= 0xFF;    P0 &= 0x00;
  35          #define    IO_PORT1_OUTPUT_LOW        P1M |= 0xFF;    P1 &= 0x00;
  36          #define    IO_PORT3_OUTPUT_LOW        P3M |= 0xFF;    P3 &= 0x00;
  37          #define    IO_PORT4_OUTPUT_LOW        P4M |= 0xFF;    P4 &= 0x00;
  38          
  39          /**
  40           *  @Brief    main: PWM1 Demo Function
  41           *  @param    None
  42           *  @return   None
  43           */
  44          
  45          void main(void)
  46          {
  47   1        /*
  48   1         *  System initial:
  49   1         *  (1) GPIO
  50   1         *  Pwm App Fuction:
  51   1         *  (2) PWM10   (Period[n*100us],duty percentage)
  52   1         *  (3) PWM11   (Period[n*100us],duty percentage)
  53   1         *  (4) PWM12   (Period[n*100us],duty percentage)
  54   1         *  (5) PWM13   (Period[n*100us],duty percentage)
C51 COMPILER V9.54   MAIN                                                                  05/06/2022 16:40:02 PAGE 2   

  55   1         */ 
  56   1          GPIO_Initialization();                                                  /*  (1) */
  57   1          PWM_InitializePwm10(10,75);                                             /*  (2) */
  58   1          PWM_InitializePwm11(10,40);                                             /*  (3) */
  59   1          PWM_InitializePwm12(20,33);                                             /*  (4) */
  60   1          PWM_InitializePwm13(25,75);                                             /*  (5) */
  61   1      
  62   1          while(1)
  63   1          {
  64   2        /*  
  65   2         *  (1) Clear Watchdog Timer
  66   2         *  Use Oscilloscope To Check the PWM Duty
  67   2         *   
  68   2         */
  69   2            WDTR = 0x5A;                                                          /*  (1) */
  70   2          }
  71   1      }
  72          
  73          
  74          
  75          /**
  76           *  @Brief    initial GPIO status
  77           *  @param    None
  78           *  @return   None
  79           */
  80          
  81          void GPIO_Initialization(void)
  82          {     
  83   1          IO_PORT0_OUTPUT_LOW
  84   1          IO_PORT1_OUTPUT_LOW
  85   1          IO_PORT3_OUTPUT_LOW
  86   1          IO_PORT4_OUTPUT_LOW
  87   1      }
  88          
  89          /**
  90           *  @Brief    PWM_ExecutePwm10Init: initial PWM10 Function
  91           *  @param    pwm10_period,pwm10_percentage
  92           *  @return   None
  93           */
  94          void PWM_InitializePwm10(uint16_t pwm10_period,uint8_t pwm10_percentage)
  95          { 
  96   1        /*  
  97   1         *  (1) Set PWM1 Period 
  98   1         *  (2) Set PWM1 Period
  99   1         *  (3) Set PWM10 Duty
 100   1         *  (4) Set PWM10 Duty 
 101   1         *  (5) Set PWM1 Freq Division and PWM10 As PWM Channel
 102   1         *  (6) PWM1 Enable 
 103   1         *   
 104   1         */
 105   1          PW1YH = ((pwm10_period*25)&0xFF00)>>8;                                  /*  (1) */  
 106   1          PW1YL = ((pwm10_period*25)&0xFF);                                       /*  (2) */  
 107   1          PW10DH  = (uint16_t) (pwm10_period*pwm10_percentage)>>10;               /*  (3) */
 108   1          PW10DL  = (uint16_t) (pwm10_period*pwm10_percentage)>>2;                /*  (4) */
 109   1          PW1M  |=  (mskPW1M_PWM1_DIV128|mskPW1CH_PW1CH0);                        /*  (5) */
 110   1          PW1M  |=  mskPW1M_PW1EN;                                                /*  (6) */
 111   1      }
 112          
 113          
 114          /**
 115           *  @Brief    PWM_ExecutePwm11Init: initial PWM11 Function
 116           *  @param    pwm11_period,pwm11_percentage
C51 COMPILER V9.54   MAIN                                                                  05/06/2022 16:40:02 PAGE 3   

 117           *  @return   None
 118           */
 119          void PWM_InitializePwm11(uint16_t pwm11_period,uint8_t pwm11_percentage)
 120          {
 121   1        /*  
 122   1         *  (1) Set PWM1 Period 
 123   1         *  (2) Set PWM1 Period
 124   1         *  (3) Set PWM10 Duty
 125   1         *  (4) Set PWM10 Duty 
 126   1         *  (5) Set PWM1 Freq Division and PWM10 As PWM Channel
 127   1         *  (6) PWM1 Enable 
 128   1         *   
 129   1         */
 130   1          PW1YH = ((pwm11_period*25)&0xFF00)>>8;                                  /*  (1) */  
 131   1          PW1YL = ((pwm11_period*25)&0xFF);                                       /*  (2) */  
 132   1          PW11DH  = (uint16_t) (pwm11_period*pwm11_percentage)>>10;               /*  (3) */
 133   1          PW11DL  = (uint16_t) (pwm11_period*pwm11_percentage)>>2;                /*  (4) */
 134   1          PW1M  |=  (mskPW1M_PWM1_DIV128|mskPW1CH_PW1CH1);                        /*  (5) */
 135   1          PW1M  |=  mskPW1M_PW1EN;                                                /*  (6) */    
 136   1      }
 137          
 138          /**
 139           *  @Brief    PWM_ExecutePwm12Init: initial PWM12 Function
 140           *  @param    pwm12_period,pwm12_percentage
 141           *  @return   None
 142           */
 143          void PWM_InitializePwm12(uint16_t pwm12_period,uint8_t pwm12_percentage)
 144          {
 145   1        /*  
 146   1         *  (1) Set PWM1 Period 
 147   1         *  (2) Set PWM1 Period
 148   1         *  (3) Set PWM10 Duty
 149   1         *  (4) Set PWM10 Duty 
 150   1         *  (5) Set PWM1 Freq Division and PWM10 As PWM Channel
 151   1         *  (6) PWM1 Enable 
 152   1         *   
 153   1         */ 
 154   1          PW1YH = ((pwm12_period*25)&0xFF00)>>8;                                  /*  (1) */  
 155   1          PW1YL = ((pwm12_period*25)&0xFF);                                       /*  (2) */  
 156   1          PW12DH  = (uint16_t) (pwm12_period*pwm12_percentage)>>10;               /*  (3) */
 157   1          PW12DL  = (uint16_t) (pwm12_period*pwm12_percentage)>>2;                /*  (4) */
 158   1          PW1M  |=  (mskPW1M_PWM1_DIV128|mskPW1CH_PW1CH2);                        /*  (5) */
 159   1          PW1M  |=  mskPW1M_PW1EN;                                                /*  (6) */    
 160   1      }
 161          
 162          /**
 163           *  @Brief    PWM_ExecutePwm13Init: initial PWM13 Function
 164           *  @param    pwm13_period,pwm13_percentage
 165           *  @return   None
 166           */
 167          void PWM_InitializePwm13(uint16_t pwm13_period,uint8_t pwm13_percentage)
 168          {
 169   1        /*  
 170   1         *  (1) Set PWM1 Period 
 171   1         *  (2) Set PWM1 Period
 172   1         *  (3) Set PWM10 Duty
 173   1         *  (4) Set PWM10 Duty 
 174   1         *  (5) Set PWM1 Freq Division and PWM10 As PWM Channel
 175   1         *  (6) PWM1 Enable 
 176   1         *   
 177   1         */ 
 178   1          PW1YH = ((pwm13_period*25)&0xFF00)>>8;                                  /*  (1) */  
C51 COMPILER V9.54   MAIN                                                                  05/06/2022 16:40:02 PAGE 4   

 179   1          PW1YL = ((pwm13_period*25)&0xFF);                                       /*  (2) */
 180   1          PW13DH  = (uint16_t) (pwm13_period*pwm13_percentage)>>10;               /*  (3) */
 181   1          PW13DL  = (uint16_t) (pwm13_period*pwm13_percentage)>>2;                /*  (4) */
 182   1          PW1M  |=  (mskPW1M_PWM1_DIV128|mskPW1CH_PW1CH3);                        /*  (5) */
 183   1          PW1M  |=  mskPW1M_PW1EN;                                                /*  (6) */    
 184   1      }
 185          


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