⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 power.lst

📁 矿工定位系统单端
💻 LST
字号:
C51 COMPILER V7.05   POWER                                                                 04/08/2005 13:54:33 PAGE 1   


C51 COMPILER V7.05, COMPILATION OF MODULE POWER
OBJECT MODULE PLACED IN power.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE power.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          //power.c - code recommendation for C header file
   2          /***********************************************************************
   3          MODULE:    POWER MANAGEMENT
   4          VERSION:   1.01
   5          CONTAINS:  Routines for controlling the power features on the Philips
   6                     P89LPC932
   7          COPYRIGHT: Embedded Systems Academy, Inc. - www.esacademy.com
   8          LICENSE:   May be freely used in commercial and non-commercial code
   9                     without royalties provided this copyright notice remains
  10                     in this file and unaltered
  11          WARNING:   IF THIS FILE IS REGENERATED BY CODE ARCHITECT ANY CHANGES
  12                     MADE WILL BE LOST. WHERE POSSIBLE USE ONLY CODE ARCHITECT
  13                     TO CHANGE THE CONTENTS OF THIS FILE
  14          GENERATED: On "Feb 24 2004" at "19:07:23" by Code Architect 2.03
  15          ***********************************************************************/
  16          
  17          // SFR description needs to be included
  18          #include<REG922.h>
  19          #include "power.h"
  20          
  21          /***********************************************************************
  22          DESC:    Enables brownout detection to generate either a reset or
  23                   interrupt
  24          RETURNS: Nothing
  25          CAUTION: If interrupts are being used then EA must be set to 1
  26                   after calling this function
  27                   UCFG1.5 (BOE) must be set to 1
  28                   Turns off any power reduction mode currently in effect
  29          ************************************************************************
  30          void power_brownoutenable(unsigned char type  )   // POWER_BORESET or POWER_BOINTERRUPT
  31           
  32          {
  33            if (type == POWER_BORESET)
  34            {
  35              // no power reduction, enable brownout, disable interrupt
  36              PCON &= 0xCC;
  37              // enable brownout detect
  38              EBO = 1;
  39            }
  40            else if (type == POWER_BOINTERRUPT)
  41            {
  42              // no power reduction, enable brownout, enable interrupt
  43              PCON &= 0xCC;
  44              PCON |= 0x10;
  45          
  46              // set isr priority to 0
  47              IP0 &= 0xDF;
  48              IP0H &= 0xDF;
  49          
  50              // enable brownout detect
  51              EBO = 1;
  52            }
  53          } // power_brownoutenable
  54          
  55          /***********************************************************************
C51 COMPILER V7.05   POWER                                                                 04/08/2005 13:54:33 PAGE 2   

  56          DESC:    Disables brownout detection
  57          RETURNS: Nothing
  58          CAUTION: UCFG1.5 (BOE) is ignored
  59          ************************************************************************
  60          void power_brownoutdisable(void)
  61          {
  62            // disable brownout
  63            PCON |= 0x20;
  64          } // power_brownoutdisable
  65          
  66          /***********************************************************************
  67          DESC:    Indicates if the last reset was caused by a brownout reset
  68                   Only use this if brownout is enabled with POWER_BORESET
  69          RETURNS: 0 if the reset was not a brownout reset
  70                   1 if the reset was a brownout reset
  71          ***********************************************************************
  72          unsigned char power_isbrownoutreset(void)
  73          {
  74            unsigned char bof;
  75          
  76            // get bof
  77            bof = (RSTSRC >> 5) & 0x01;
  78          
  79            // clear bof
  80            RSTSRC &= ~0x20;
  81          
  82            // return bof
  83            return bof;
  84          } // power_isbrownoutreset
  85          
  86          /***********************************************************************
  87          DESC:    Brownout Interrupt
  88          RETURNS: Nothing
  89          CAUTION: uart_init must be called first
  90                   EA must be set to 1
  91          ************************************************************************/
  92          void power_brownoutisr(void ) interrupt 5 using 1
  93          {
  94   1        // clear bof
  95   1        RSTSRC &= ~0x20;
  96   1      } // power_brownoutisr
  97          
  98          /***********************************************************************
  99          DESC:    Indicates if the last reset was caused by power on
 100          RETURNS: 0 if the reset was not power on
 101                   1 if the reset was power on
 102          ***********************************************************************
 103          unsigned char power_ispoweronreset(void)
 104          {
 105            unsigned char pof;
 106          
 107            // get pof
 108            pof = (RSTSRC >> 4) & 0x01;
 109          
 110            // clear pof
 111            RSTSRC &= ~0x10;
 112          
 113            // return pof
 114            return pof;
 115          } // power_ispoweronreset
 116          */
 117          /***********************************************************************
C51 COMPILER V7.05   POWER                                                                 04/08/2005 13:54:33 PAGE 3   

 118          DESC:    Selects a power reduction mode
 119          RETURNS: nothing
 120          CAUTION: Some modes will cause various peripherals to either work
 121                   differently or stop working
 122          ************************************************************************/
 123          void power_mode(unsigned char mode  ) // power reduction mode POWER_NORMAL, POWER_IDLE
 124                                // POWER_POWERDOWN or POWER_TOTALPOWERDOWN
 125           
 126          {
 127   1        // disable power reduction
 128   1        PCON &= 0xFC;
 129   1      
 130   1        if (mode == POWER_IDLE)
 131   1          PCON |= 0x01;
 132   1        else if (mode == POWER_POWERDOWN)
 133   1          PCON |= 0x02;
 134   1        else if (mode == POWER_TOTALPOWERDOWN)
 135   1          PCON |= 0x03;
 136   1      } // power_mode
 137          
 138          /***********************************************************************
 139          DESC:    Powers down one or more peripherals
 140          RETURNS: nothing
 141          ***********************************************************************
 142          void power_powerdown( unsigned char peripherals  )  // ORd list of peripherals to power down
 143                                        // e.g. POWER_RTC | POWER_SPI
 144           
 145          {
 146            // power down peripherals
 147            PCONA |= peripherals;
 148          } // power_powerdown
 149          
 150          /***********************************************************************
 151          DESC:    Powers up one or more peripherals that were previously powered
 152                   down
 153          RETURNS: nothing
 154          ***********************************************************************
 155          void power_powerup(unsigned char peripherals  )   // ORd list of peripherals to power up
 156                                        // e.g. POWER_RTC | POWER_SPI
 157          
 158          {
 159            // power up peripherals
 160            PCONA &= ~peripherals;
 161          } // power_powerup
 162          */


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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -