gpasm-1.7.0_beta1 (Feb  6 2015)D:\ZMJWork\project\MC32P7311\luozheng_demo\zmj7311\Mobile_BAT\mobile_bat0715_step.asm2015-7-22  11:32:13          PAGE  1


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00001 ;27M 实际芯片23M 仿真16M
                      00002 ;AD基准电压是2.5V
                      00003 ;注意十进制和十六进制的表示
                      00004 #include "mc32P7311.inc"
                      00001 
                      00002 
                      00003 ;mc32p7311 header file
                      00004 ;
                      00005 ; 
                      00006 
                      00007 ;define must write at first row
                      00008        
  00000180            00009 INDF0   EQU     H'0180'
  00000181            00010 INDF1   EQU     H'0181'
  00000182            00011 INDF2   EQU     H'0182'
  00000183            00012 HIBYTE  EQU     H'0183'
  00000184            00013 FSR0    EQU     H'0184'
  00000185            00014 FSR1    EQU     0X185
  00000186            00015 PCL     EQU     0X186
  00000187            00016 PFLAG   EQU     0X187
  00000188            00017 MCR     EQU     0X188
  00000189            00018 INDF3   EQU     0X189   
  0000018A            00019 INTE    EQU     0X18A
  0000018B            00020 INTF    EQU     0X18B
  0000018C            00021 DRVCR0  EQU     0X18C
  0000018D            00022 DRVCR1  EQU     0X18D
  0000018E            00023 KBCR    EQU     0X18E
                      00024 
  00000190            00025 IOP0    EQU     0X190
  00000191            00026 OEP0    EQU     0X191
  00000192            00027 PUP0    EQU     0X192
  00000193            00028 PDP0    EQU     0X193
  00000194            00029 IOP1    EQU     0X194
  00000195            00030 OEP1    EQU     0X195
  00000196            00031 PUP1    EQU     0X196
  00000197            00032 PDP1    EQU     0X197
                      00033 
  00000198            00034 T0CR    EQU     0X198
  00000199            00035 T0CNT   EQU     0X199
  0000019A            00036 T0LOAD  EQU     0X19A
  0000019B            00037 T0DATA  EQU     0X19B
  0000019C            00038 T1CR    EQU     0X19C
  0000019D            00039 T1CNT   EQU     0X19D
  0000019E            00040 T1LOAD  EQU     0X19E
  0000019F            00041 T1DATA  EQU     0X19F
  000001A0            00042 T2CR    EQU     0X1A0
  000001A1            00043 T2CNT   EQU     0X1A1
  000001A2            00044 T2LOAD  EQU     0X1A2
  000001A3            00045 T2DATA  EQU     0X1A3
  000001A4            00046 T3CR    EQU     0X1A4
  000001A5            00047 T3CNT   EQU     0X1A5
  000001A6            00048 T3LOAD  EQU     0X1A6
                      00049 
  000001A8            00050 T0DE    EQU     0X1A8
  000001A9            00051 T1DE    EQU     0X1A9
  000001AA            00052 T2DE    EQU     0X1AA
                      00053 
  000001AC            00054 PWMCR0   EQU     0X1AC
  000001AD            00055 PWMCR1   EQU     0X1AD
                      00056 
  000001AE            00057 OSCM    EQU     0X1AE
  000001AF            00058 LVDCR   EQU     0X1AF
                      00059 
  000001B0            00060 ADCR0   EQU     0X1B0
  000001B1            00061 ADCR1   EQU     0X1B1
  000001B2            00062 ADCR2   EQU     0X1B2
                      00063 
  000001B4            00064 ADRH    EQU     0X1B4
  000001B5            00065 ADRL    EQU     0X1B5
  000001B6            00066 ANSEL0  EQU     0X1B6
  000001B7            00067 ANSEL1  EQU     0X1B7
                      00068 
  000001FB            00069 OSCCAL  EQU     0X1FB
                      00070 
                      00071 #define         STATUS          PFLAG
                      00072 #define         INDF            INDF0
                      00073 #define         FSR             FSR0
                      00074 #define         P0HCON          PUP0
                      00075 #define         P1HCON          PUP1
                      00076 #define         INTECON         INTE    
                      00077 
                      00078 ;int 
                      00079 #define         GIE             MCR,7
                      00080 #define         T0              MCR,5
                      00081 #define         PD              MCR,4
                      00082 #define         MINT11          MCR,3
                      00083 #define         MINT10          MCR,2
                      00084 #define         MINT01          MCR,1
                      00085 #define         MINT00          MCR,0
                      00086   
                      00087 
                      00088 ;pflag bit 
                      00089 #define         Z       PFLAG,2
                      00090 #define         DC      PFLAG,1
                      00091 #define         C       PFLAG,0 
                      00092 
                      00093 
                      00094 ;INTE0
                      00095 ; 1=enable, 0=disable
                      00096 #define         ADIE    INTE,6
                      00097 #define         T2IE    INTE,5
                      00098 #define         KBIE    INTE,4
                      00099 #define         INT1IE  INTE,3
                      00100 #define         INT0IE  INTE,2
                      00101 #define         T1IE    INTE,1
                      00102 #define         T0IE    INTE,0
                      00103 
                      00104 ;TIME0
                      00105 #define         TC0EN           T0CR,7
                      00106 #define         PWM0OE          T0CR,6
                      00107 #define         BUZ0OE          T0CR,5
                      00108 #define         T0PS1           T0CR,4
                      00109 #define         T0PS0           T0CR,3
                      00110 #define         T0PR2           T0CR,2
                      00111 #define         T0PR1           T0CR,1
                      00112 #define         T0PR0           T0CR,0
                      00113 
                      00114 ;TIME1
                      00115 #define         TC1EN           T1CR,7
                      00116 #define         PWM1OE          T1CR,6
                      00117 #define         BUZ1OE          T1CR,5
                      00118 #define         T1PS1           T1CR,4
                      00119 #define         T1PS0           T1CR,3
                      00120 #define         T1PR2           T1CR,2
                      00121 #define         T1PR1           T1CR,1
                      00122 #define         T1PR0           T1CR,0
                      00123 
                      00124 ;TIME2
                      00125 #define         TC2EN           T2CR,7
                      00126 #define         PWM2OUT         T2CR,6
                      00127 #define         BUZ2OE          T2CR,5
                      00128 #define         T2PS1           T2CR,4
                      00129 #define         T2PS0           T2CR,3
                      00130 #define         T2PR2           T2CR,2
                      00131 #define         T2PR1           T2CR,1
                      00132 #define         T2PR0           T2CR,0
                      00133 
                      00134 ;TIME3
                      00135 #define         TC3EN           T3CR,7
                      00136 
                      00137 #define         T3PS1           T3CR,4
                      00138 #define         T3PS0           T3CR,3
                      00139 #define         T3PR2           T3CR,2
                      00140 #define         T3PR1           T3CR,1
                      00141 #define         T3PR0           T3CR,0
                      00142 
                      00143 ;OSCM
                      00144 #define         STBL    OSCM,5
                      00145 #define         STBH    OSCM,4
                      00146 #define         CLKS    OSCM,2
                      00147 #define         LFEN    OSCM,1
                      00148 #define         HFEN    OSCM,0          
                      00149 
                      00150 
                      00151 ;INTF
                      00152 ;1=active ,
                      00153 #define         ADIF    INTF,6 
                      00154 #define         T2IF    INTF,5
                      00155 #define         KBIF    INTF,4
                      00156 #define         INT1IF  INTF,3
                      00157 #define         INT0IF  INTF,2
                      00158 #define         T1IF    INTF,1
                      00159 #define         T0IF    INTF,0
                      00160 
                      00161 ;----------ADC------------
                      00162 #define AIN0                                    0<<4
                      00163 #define AIN1                                    1<<4
                      00164 #define AIN2                                    2<<4
                      00165 #define AIN3                                    3<<4
                      00166 #define AIN4                                    4<<4
                      00167 #define AIN5                                    5<<4
                      00168 #define VDD_DIV3                        6<<4
                      00169 #define VOUTV_DIV3              7<<4
                      00170 
                      00171 
                      00172 #define FSYS_DIV16              0<<2
                      00173 #define FSYS_DIV8                       1<<2
                      00174 #define FSYS_DIV4                       2<<2
                      00175 #define FSYS_DIV2                       3<<2
                      00176 
                      00177 #define ADEOC           ADCR0,1
                      00178 #define ADON            ADCR0,0
                      00179 
                      00180 #define RESS0           ADCR1,3
                      00181 #define VRS2            ADCR1,2
                      00182 #define VRS1            ADCR1,1
                      00183 #define VRS0            ADCR1,0
                      00184 ;#define        inca    addai 1
                      00185 
                      00186 
                      00187 #define DDR0            OEP0
                      00188 #define DD00            DDR0,0
                      00189 #define DD01            DDR0,1
                      00190 #define DD02            DDR0,2
                      00191 #define DD03            DDR0,3
                      00192 #define DD04            DDR0,4
                      00193 #define DD05            DDR0,5
                      00194 
                      00195 #define P0      IOP0
                      00196 #define P00     P0,0
                      00197 #define P01     P0,1
                      00198 #define P02     P0,2
                      00199 #define P03     P0,3
                      00200 #define P04     P0,4
                      00201 #define P05     P0,5
                      00202 
                      00203 
                      00204 #define DDR1            OEP1
                      00205 #define DD10            DDR1,0
                      00206 #define DD11            DDR1,1
                      00207 #define DD12            DDR1,2
                      00208 #define DD13            DDR1,3
                      00209 #define DD14            DDR1,4
                      00210 #define DD15            DDR1,5
                      00211 #define DD16            DDR1,6
                      00212 #define DD17            DDR1,7
                      00213 
                      00214 #define P1      IOP1
                      00215 #define P10     P1,0
                      00216 #define P11     P1,1
                      00217 #define P12     P1,2
                      00218 #define P13     P1,3
                      00219 #define P14     P1,4
                      00220 #define P15     P1,5
                      00221 #define P16     P1,6
                      00222 #define P17     P1,7
                      00223 
                      00224 
                      00005 
                      00006 ;==============IO口定义===============
                      00007 #define    VREF            P0,4    ;参考电压2.5V
                      00008 #define    DET_CURRENT     P0,2    ;电流检测
                      00009 #define    LIGHT_LED       P1,0    ;照明灯
                      00010 #define    BOOST_EN        P0,5    ;升压使能
                      00011 
                      00012 #define    KEY_I           P1,3    ;按键
                      00013 #define    LED34           P1,4    ;电量指示
                      00014 #define    LED12           P1,5
                      00015 #define    LED56           P1,0
                      00016 #define    LED78           P0,3
                      00017 #define    CHRG            P1,1    ;检测POWER5v
                      00018 
                      00019 #define    PMOS            P1,6    ;充电PWM控制
                      00020 #define    NMOS            P1,7    ;升压PWM控制
                      00021 
                      00022 ;==============常量定义===============
                      00023 #define   KEY_EFFECT         100 ;按键抖动计数
                      00024 #define   NO_KEY             0  ;无按键
                      00025 #define   SHORT_KEY          1  ;短按
                      00026 #define   LONG_KEY           2  ;长按--
                      00027 
                      00028 #define   BAT_ADCH           0xa9  ;AD通道选择;1/4VOUT1设为0xc9;1/4VDD设为0xa9
                      00029 #define   BOOST5V_ADCH       0xb9  ;1/4VOUT0
                      00030 #define   CURRENT_ADCH       0x59  ;AN5
                      00031 
                      00032 ;参考电压外部2.5V ,采样12Bit ,1/3 outv ,1/3vdd ,十进制
                      00033 #define         LOW_VBAT_AD         1280 ; 电池低于3v
                      00034 #define         VBAT_AD0            1365 ; 3.2v 低压报警1/4VOUT0 
                      00035 #define         VBAT_AD1            1493 ; 3.5v led1  
                      00036 #define         VBAT_AD2            1600 ; 3.75v led2  
                      00037 #define         VBAT_AD3            1664 ; 3.9v < led3 > led4
                      00038 
                      00039 ;====充电参数=======
                      00040 #define         CHARGE_PWM_DUTY_MAX             98 ;充电最大占空比
                      00041 #define         CHARGE_PWM_DUTY_MIN             10 ; 充电最小占空比
                      00042 
                      00043 #define         SHUT_OFF_CURRENT_AD             8  ; 充电电流关断值 100mA*0.05R
                      00044 #define         CONST_CURRENT_AD                82  ;1A 164     ;恒流充电值 2A
                      00045 
                      00046 #define         CONST_VOLTAGE_AD                2320;2293 ; 恒压充电值 4.25V
                      00047 #define         FULL_VOLTAGE_AD                 2370;2347  ; 充满电压值 4.25V
                      00048 
                      00049 #define         CHARGE_FULL_CNT                 100 ;充满计数
                      00050 
                      00051 ;=====升压参数=======
                      00052 #define         BOOST_PWM_DUTY_MIN              2 ;P16 P17反向输出 最小占空比不能为0 最大也不能到T1LOAD的值
                      00053 #define         BOOST_PWM_DUTY_MAX              25 ;50
                      00054 
                      00055 #define         BOOST_5V_CONST_AD               2730  ;5V+0.1(0.2)二极管压降
                      00056 
                      00057 ;无负载计数值
                      00058 #define         NO_LOAD_CNT                     5 ;判断负载拔掉次数
                      00059 #define         LOAD_CNT                                                                5
                      00060 
                      00061 ;检测负载电流时的AD值范围
                      00062 #define         LOAD_CURRENT_AD_MIN             8 ; 无负载判断 100mA*0.05R
                      00063 #define         LOAD_CURRENT_AD_MAX            188  ;限流值 2.3A*0.05R
                      00064 #define         SHORT_CIRCUIT_AD               400  ;短路保护电流值
                      00065 
                      00066 ;==============变量定义 RAM ===============
                      00067         cblock  0x0
                      00068  accTemp  ;中断保存暂存器
                      00069  statusTemp
                      00070 
                      00071  DelayCnt ;延时计数
                      00072  DelayCnt1
                      00073 
                      00074  keyCode         ;键值
                      00075  keyFilterTime   ;按键去抖时间
                      00076  keyPressTime    ;按键时间 
                      00077 
                      00078  time_1ms  ;计时
                      00079  time_10ms
                      00080  time_100ms
                      00081  time_500ms
                      00082  sleepTime
                      00083 
                      00084  Flag                ;标志位寄存器
                      00085  Flag1
                      00086  Flag2
                      00087 
                      00088  ledFlags   ;LED灯标志位 用低4位
                      00089  ledScanCnt ; LED扫描计数
                      00090 
                      00091  displayMode ;电池显示模式
                      00092 
                      00093  cycleCnt ;循环计数
                      00094  cycleCnt1;
                      00095 
                      00096  sumAD        :2 ;多次AD值的和
                      00097  adValue      :2 ;单次采样值
                      00098  vbatAD       :2 ;电池电压值
                      00099  currentAD    :2 ;电流检测值
                      00100  lastAD       :2 ;上一次值
                      00101  boostAD5V    :2 ;升压5V值
                      00102  adAvg        :2
                      00103 
                      00104  adChTemp     ;AD通道
                      00105  ;shortCircuitAD; :2
                      00106  
                      00107  loadCnt 
                      00108  noLoadCnt
                      00109  chargeFullCnt ; 充满计数
                      00110  dutyChargeCnt
                      00111  dutyBoostCnt
                      00112  filterCnt
                      00113  marqueeLEDFlags ;跑马灯数量 值为0x1 x03 0x7 0xf
                      00114  loopCnt
                      00115         endc
                      00116 ;==========寄存器标志位=======================
                      00117 #define         F_keyRelease     Flag,0  ;按键释放
                      00118 #define         F_keyValid       Flag,1  ;按键有效
                      00119 #define         F_load           Flag,2  ;负载标志 1 active
                      00120 #define         F_power5V        Flag,3  ;检测5V接入
                      00121 #define         F_sleep          Flag,4  ;睡眠标志
                      00122 #define         F_ledOff         Flag,5  ;LED指示灯灭
                      00123 #define         F_showVBAT       Flag,6  ;电量显示
                      00124 #define         F_blink          Flag,7  ;闪烁标志
                      00125 
                      00126 #define         F_time10ms       Flag1,0 ;10ms标志 
                      00127 #define         F_time100ms      Flag1,1 ;100ms标志
                      00128 #define         F_chargeFull     Flag1,2 ;充满标志   
                      00129 #define         F_preCharge      Flag1,3 ;预充电
                      00130 #define         F_time500ms      Flag1,4 ;500ms标志
                      00131 #define         F_detLoad        Flag1,5 ;开始检测负载
                      00132 #define         F_lightSwitch    Flag1,6 ;照明灯开关
                      00133 #define         F_displayEn      Flag1,7 ;显示使能
                      00134 
                      00135 #define         F_noLoadState     Flag2,0 ;空载状态
                      00136 #define         F_marquee500ms    Flag2,1 ;跑马灯间隔时间
                      00137 
                      00138 ;=============程序开始======================
                      00139 
                      00140                 ORG             0x00
0000   DF88           00141                 bclr            GIE     ;关中断
0001   A000           00142                 goto            START
                      00143 
                      00144 ;=============中断向量====================
                      00145                ORG              0x08
0008                  00146 InterruptVector:
0008   5600           00147                movra       accTemp   ;中断之前保存ACC里面的值
0009   4587           00148                swapar      STATUS    ;中断之前保存状态寄存器
000A   5601           00149                movra       statusTemp
                      00150 
000B                  00151 TIM0_IRQ:
                      00152           ;jbclr      T0IE     ;是否开启了定时器0  开启1 关闭0
000B   E18B           00153           jbset       T0IF     ;定时器0是否产生了中断 1产生 0无
000C   A000           00154           goto        TIM1_IRQ
000D   D18B           00155           bclr        T0IF
                      00156 
000E                  00157 TIM1_IRQ:
                      00158           ;jbclr      T1IE   ;是否开启了定时器1  开启1 关闭0
000E   E38B           00159           jbset       T1IF   ;定时器1是否产生了中断 1产生 0无
000F   A000           00160           goto        TIM2_IRQ
0010   D38B           00161           bclr        T1IF
                      00162 
0011                  00163 TIM2_IRQ:
                      00164           ;jbclr      T2IE   ;是否开启了定时器2  开启1 关闭0
0011   EB8B           00165           jbset       T2IF   ;定时器2是否产生了中断 1产生 0无
0012   A000           00166           goto        INT0_IRQ
0013   DB8B           00167           bclr        T2IF
0014   6607           00168           incr        time_1ms
0015   EE0D           00169           jbset       F_displayEn
0016   A000           00170           goto        TimeAccumulation ;时间累加
0017   8000           00171           call        _DisplayLED
0018                  00172 TimeAccumulation:
0018   3C0A           00173           movai       10
0019   4007           00174           xorar       time_1ms
001A   E587           00175           jbset       Z
001B   A000           00176           goto        INT0_IRQ
001C   7607           00177           clrr        time_1ms
001D   6608           00178           incr        time_10ms
001E   C00D           00179           bset        F_time10ms
                      00180                                 
                      00181 
001F                  00182 INT0_IRQ: ;外部中断0
                      00183           ;jbclr      INT0IE ; 1开启了外部中断0 0关闭
001F   E58B           00184           jbset       INT0IF
0020   A000           00185           goto        INT1_IRQ
0021   D58B           00186           bclr        INT0IF
                      00187 
0022                  00188 INT1_IRQ: ;外部中断1
                      00189             ;jbclr      INT1IE ; 1开启了外部中断 0关闭
0022   E78B           00190             jbset       INT1IF
0023   A000           00191             goto        KBIM_IRQ
0024   D78B           00192             bclr        INT1IF
                      00193 
0025                  00194 KBIM_IRQ: ;键盘中断
                      00195             ;jbclr      KBIE
0025   E98B           00196             jbset       KBIF
0026   A000           00197             goto        ExitInterrupt
0027   D98B           00198             bclr        KBIF
                      00199                                 
                      00200 
0028                  00201 ExitInterrupt:;中断恢复
0028   4401           00202                 swapar      statusTemp
0029   5787           00203                 movra       STATUS
                      00204                 ;swapr      acc_temp
                      00205                 ;swapar     acc_temp
002A   5800           00206                 movar       accTemp
002B   000D           00207                 retie
                      00208 ;=========end interrupt===========
                      00209 
                      00210 ;==========初始化寄存器===========
002C                  00211 _InitRst:
                      00212 
002C   3CFF           00213         movai       0xff
002D   5790           00214         movra       IOP0
002E   3CFF           00215         movai       0xff
002F   5794           00216         movra       IOP1
                      00217         
0030   3C00           00218         movai       0x00
0031   5792           00219         movra       PUP0
0032   3C02           00220         movai       0x02
0033   5796           00221         movra       PUP1
                      00222         
0034   3CEB           00223         movai       0xeb
0035   5791           00224         movra       OEP0    ;P02 P04 做输入
0036   3CF5           00225         movai       0xf5
0037   5795           00226         movra       OEP1    ;P11 P13做输入
                      00227         
0038   3C0A           00228         movai       0x0a
0039   57B6           00229         movra       ANSEL0   ;P02 P04做AD采样
                      00230         
003A   3C00           00231         movai       0x00    ;时钟源为FCPU 1分频 仿真只有16M 实际芯片23M
003B   5798           00232         movra       T0CR
003C   3C63           00233         movai       99
003D   579A           00234         movra       T0LOAD  ;PWM充电频率 ((1/23)/4)*1*(99+1) = 57K 充电频率
003E   3C00           00235         movai       0
003F   579B           00236         movra       T0DATA
                      00237         
0040   3C08           00238         movai       0x08     ;时钟源为FHOSC 1分频
0041   579C           00239         movra       T1CR
0042   3C3F           00240         movai       63
0043   579E           00241         movra       T1LOAD  ;升压PWM频率(1/27)*1*(63+1) 421K 实际23M
0044   3C00           00242         movai       0
0045   579F           00243         movra       T1DATA
                      00244         
0046   3C05           00245         movai       0x05
0047   57A0           00246         movra       T2CR        ; 23/4 = 5.75M  时钟为FCPU，32分频
0048   3CB3           00247         movai       179
0049   57A2           00248         movra       T2LOAD
                      00249         
004A   3C01           00250         movai       0x01
004B   5788           00251         movra       MCR         ;外部中断0 下降沿中断
004C   3C00           00252         movai       0x00
004D   57AC           00253         movra       PWMCR0
004E   3C40           00254         movai       0x40
004F   57B1           00255         movra       ADCR1      ;AD时钟频率FHIRC/8=4MHz
                      00256         ;bset       VRES        ;开1K上拉 使能外部参考电压 针对TL431
0050   C1B1           00257         bset        VRS0        ;选择外部参考2.5V
0051   C3B1           00258         bset        VRS1
0052   C5B1           00259         bset        VRS2
                      00260         
0053   CFA0           00261         bset       TC2EN
0054   CB8A           00262         bset       T2IE
0055   C78E           00263         bset       KBCR,3
0056   C58A           00264         bset       INT0IE
                      00265         
                      00266         ;bset      TC0EN
                      00267         ;bset      PWM0OE
                      00268         
                      00269         ;bset      PWMCR,7   ; 允许PWM1 翻转输出到PWM0 故PWM0无需设置
                      00270         ;bset      PWMCR,6   ; PWM0与FPWM1 取反
                      00271         ;movai     0xc5
                      00272         ;movra     PWMCR
                      00273         ;bset      TC1EN
                      00274         ;bset      PWM1OE
0057   000C           00275         return
                      00276 ;==========end 初始化========
                      00277 
                      00278 ;=========初始化 RAM=========
0058                  00279 _InitRAM:
0058   7784           00280            clrr        FSR0   
0059                  00281 InitRAM0:
0059   7780           00282            clrr        INDF0                       
005A   6784           00283            incr        FSR0
005B   3C7F           00284            movai       0x7F
005C   4984           00285            rsubar      FSR0
005D   E587           00286            jbset       Z
005E   A000           00287            goto        InitRAM0
005F   000C           00288            return
                      00289 ;======END RAM===============
                      00290 
                      00291 ;======延时函数==============
0060                  00292 _Delay:
0060   3CFF           00293          movai       0xff 
0061   5602           00294          movra       DelayCnt
                      00295 
0062                  00296 Delay_1:
0062   3CFF           00297          movai       0xFF
0063   5603           00298          movra       DelayCnt1
0064                  00299 Delay_2:
0064   6A03           00300          djzr        DelayCnt1
0065   A000           00301          goto        Delay_2
0066   6A02           00302          djzr        DelayCnt
0067   A000           00303          goto        Delay_1
0068   000C           00304          return
                      00305 ;=====END 延时函数===========
                      00306 
                      00307 
                      00308 ;;=============按键扫描=======
                      00309 ;_KeyScan: 
                      00310 ;      jbclr       KEY_I
                      00311 ;      goto        NoKeyPress
                      00312 ;      movai       KEY_EFFECT     ;按键抖动计数100
                      00313 ;      rsubar      keyFilterTime  ;按键去抖时间
                      00314 ;      jbclr       C        ;相减结果产生借位，则0→C；否则1→C
                      00315 ;      return
                      00316 ;      incr        keyFilterTime
                      00317 ;      movai       KEY_EFFECT
                      00318 ;      xorar       keyFilterTime
                      00319 ;      jbset       Z
                      00320 ;      return  
                      00321 ;      jbclr       F_keyRelease    ;按键释放
                      00322 ;      return 
                      00323 ;      bset        F_keyValid     ;按键有效
                      00324 ;      bset        F_keyRelease
                      00325 ;      clrr        keyPressTime
                      00326 ;      return 
                      00327 ;NoKeyPress:
                      00328 ;         movr        keyFilterTime ;判断是否为0
                      00329 ;         jbclr       Z          ;R为0，则1→Z；否则0→Z
                      00330 ;         return 
                      00331 ;         movai       5
                      00332 ;         rsubar      keyFilterTime
                      00333 ;         jbset       C         ;相减结果产生借位，则0→C；否则1→C
                      00334 ;         goto        ExitKeyScan
                      00335 ;         decr        keyFilterTime
                      00336 ;         return 
                      00337 ;ExitKeyScan:
                      00338 ;         clrr        keyFilterTime
                      00339 ;         bclr        F_keyRelease
                      00340 ;         return
                      00341 ;
                      00342 ;_KeyDeal:
                      00343 ;          jbset       F_keyValid
                      00344 ;          goto        ExitKeyDeal
                      00345 ;          movai       15
                      00346 ;          rsubar      keyPressTime ;判断是否为长按键
                      00347 ;          jbset       C            ;相减结果产生借位，则0→C；否则1→C
                      00348 ;          goto        JudgeShortKey ;判断是否是短按键   
                      00349 ;          bclr        F_keyValid
                      00350 ;          movai       LONG_KEY
                      00351 ;          movra       keyCode
                      00352 ;          return  
                      00353 ;JudgeShortKey:                ;判断是否为短按键
                      00354 ;            jbclr       F_keyRelease  ;判断按键是否释放
                      00355 ;            return
                      00356 ;            bclr        F_keyValid
                      00357 ;            movai       SHORT_KEY
                      00358 ;            movra       keyCode
                      00359 ;            return      
                      00360 ;ExitKeyDeal:;无按键
                      00361 ;            movai       NO_KEY
                      00362 ;            movra       keyCode
                      00363 ;            return
                      00364 ;=============END 按键扫描=============
                      00365 
                      00366 ;=============时基=====================
0069                  00367 _TimeBase:
                      00368          
0069   3C0A           00369                 movai       10
006A   4008           00370                 xorar       time_10ms
006B   E587           00371                 jbset       Z
006C   000C           00372                 return
006D   7608           00373                  clrr        time_10ms                                
006E   6606           00374                  incr        keyPressTime                                
006F   C20D           00375                  bset        F_time100ms                                
0070   6609           00376                  incr        time_100ms
0071   3C05           00377                  movai       5
0072   4009           00378                  xorar       time_100ms
0073   E587           00379                  jbset       Z
0074   000C           00380                  return                                
0075   7609           00381                  clrr        time_100ms ;500ms                                
0076   3C80           00382                  movai        0x80
0077   420C           00383                  xorra        Flag      ;异或,将bit7取反                                
0078   C80D           00384                  bset         F_time500ms
0079   C20E           00385                  bset         F_marquee500ms                                
007A   F60C           00386                  jbclr        F_power5V   ;休眠计时
007B   000C           00387                  return
007C   F40C           00388                  jbclr        F_load      ;负载标志
007D   000C           00389                  return
007E   FC0D           00390                  jbclr        F_lightSwitch;照明灯开关
007F   000C           00391                  return
0080   660B           00392                  incr         sleepTime
0081   3C14           00393                  movai        20
0082   400B           00394                  xorar        sleepTime
0083   E587           00395                  jbset        Z
0084   000C           00396                  return
0085   760B           00397                  clrr         sleepTime
0086   C80C           00398                  bset         F_sleep
0087   000C           00399                  return
                      00400 ;=============END  TIME=============
                      00401 
0088                  00402 _BatteryMode:
0088   3C55           00403            movai       low(VBAT_AD0)  ;1747(十进制) ; 3.2v 低压报警
0089   4818           00404            rsubar      vbatAD
008A   3C05           00405            movai       high(VBAT_AD0)   
008B   0C19           00406            rsbcar      vbatAD+1    
008C   F187           00407            jbclr       C          ;相减结果产生借位，则0→C（低于3.2V）；否则1→C(高于3.2V)
008D   A000           00408            goto        Battery_MODE_1  
008E   3C01           00409            movai       1
008F   A000           00410            goto        Exit_Battery_MODE
0090                  00411 Battery_MODE_1:
0090   3CD5           00412                movai       low(VBAT_AD1)
0091   4818           00413                rsubar      vbatAD
0092   3C05           00414                movai       high(VBAT_AD1)
0093   0C19           00415                rsbcar      vbatAD+1
0094   F187           00416                jbclr       C             ;相减结果产生借位，则0→C（低于3.5V）；否则1→C(高于3.5V)
0095   A000           00417                goto        Battery_MODE_2  
0096   3C02           00418                movai       2
0097   A000           00419                goto        Exit_Battery_MODE
0098                  00420 Battery_MODE_2:
0098   3C40           00421                movai       low(VBAT_AD2)
0099   4818           00422                rsubar      vbatAD
009A   3C06           00423                movai       high(VBAT_AD2)
009B   0C19           00424                rsbcar      vbatAD+1
009C   F187           00425                jbclr       C               ;相减结果产生借位，则0→C（低于3.75V）；否则1→C(高于3.75V)
009D   A000           00426                goto        Battery_MODE_3
009E   3C03           00427                movai       3
009F   A000           00428                goto        Exit_Battery_MODE
00A0                  00429 Battery_MODE_3:
00A0   3C80           00430                 movai       low(VBAT_AD3)
00A1   4818           00431                 rsubar      vbatAD
00A2   3C06           00432                 movai       high(VBAT_AD3)
00A3   0C19           00433                 rsbcar      vbatAD+1
00A4   F187           00434                 jbclr       C              ;相减结果产生借位，则0→C（低于3.9V）；否则1→C(高于3.9V)
00A5   A000           00435                 goto        Battery_MODE_4
00A6   3C04           00436                 movai       4
00A7   A000           00437                 goto        Exit_Battery_MODE
00A8                  00438 Battery_MODE_4:
00A8   3C05           00439                 movai       5
00A9                  00440 Exit_Battery_MODE:
00A9   5611           00441                 movra       displayMode
00AA   000C           00442                 return
                      00443 
00AB                  00444 _BrightLED1:
00AB   DB94           00445             bclr                            LED12
00AC   C994           00446             bset                            LED34
00AD   C194           00447             bset                            LED56
00AE   C790           00448             bset                            LED78
                      00449             ;bclr                            LEDCOM
00AF   000C           00450             return
                      00451 
00B0                  00452 _BrightLED2:
00B0   DB94           00453             bclr                            LED12
00B1   D994           00454             bclr                            LED34
00B2   C194           00455             bset                            LED56
00B3   C790           00456             bset                            LED78
                      00457             ;bset                            LEDCOM
00B4   000C           00458             return
                      00459 
00B5                  00460 _BrightLED3:
00B5   DB94           00461             bclr                            LED12
00B6   D994           00462             bclr                            LED34
00B7   D194           00463             bclr                            LED56
00B8   C790           00464             bset                            LED78
                      00465             ;bclr                            LEDCOM
00B9   000C           00466             return
                      00467 
00BA                  00468 _BrightLED4:
00BA   DB94           00469           bclr                            LED12
00BB   D994           00470           bclr                            LED34
00BC   D194           00471           bclr                            LED56
00BD   D790           00472           bclr                            LED78
                      00473           ;bset                            LEDCOM
00BE   000C           00474           return
                      00475 
00BF                  00476 _OFF_LED:
00BF   CB94           00477           bset                            LED12
00C0   C994           00478           bset                            LED34
00C1   C194           00479           bset                            LED56
00C2   C790           00480           bset                            LED78
                      00481           ;bclr                            LEDCOM
00C3   000C           00482           return
                      00483 
00C4                  00484 _DisplayLED:
00C4   5A10           00485        movr                            ledScanCnt ;LED1   将寄存器R内容存到R，会影响Z标志位
00C5   E587           00486        jbset                           Z          ;R为0，则1→Z；否则0→Z
00C6   A000           00487        goto                            DisplayLED2
00C7   3C01           00488        movai                           0x1
00C8   780F           00489        andar                           ledFlags
00C9   F587           00490        jbclr                           Z
00CA   A000           00491        goto                            LED_OFF
00CB   8000           00492        call                            _BrightLED1
00CC   A000           00493        goto                            LEDScan
                      00494 
00CD                  00495 DisplayLED2:
00CD   3C01           00496       movai                           1
00CE   4010           00497       xorar                           ledScanCnt ;LED2
00CF   E587           00498       jbset                           Z
00D0   A000           00499       goto                            DisplayLED3
00D1   3C02           00500       movai                           0x2
00D2   780F           00501       andar                           ledFlags
00D3   F587           00502       jbclr                           Z
00D4   A000           00503       goto                            LED_OFF
00D5   8000           00504       call                            _BrightLED2
00D6   A000           00505       goto                            LEDScan
                      00506 
00D7                  00507 DisplayLED3:
00D7   3C02           00508      movai                           2
00D8   4010           00509      xorar                           ledScanCnt ;LED3
00D9   E587           00510      jbset                           Z
00DA   A000           00511      goto                            DisplayLED4
00DB   3C04           00512      movai                           0x4
00DC   780F           00513      andar                           ledFlags
00DD   F587           00514      jbclr                           Z
00DE   A000           00515      goto                            LED_OFF
00DF   8000           00516      call                            _BrightLED3
00E0   A000           00517      goto                            LEDScan
                      00518 
00E1                  00519 DisplayLED4:
00E1   3C03           00520          movai                           3
00E2   4010           00521          xorar                           ledScanCnt ;LED4
00E3   E587           00522          jbset                           Z
00E4   000C           00523          return
00E5   3C08           00524          movai                           0x8
00E6   780F           00525          andar                           ledFlags
00E7   F587           00526          jbclr                           Z
00E8   A000           00527          goto                            LED_OFF
00E9   8000           00528          call                            _BrightLED4
00EA   A000           00529          goto                            LEDScan
                      00530 
00EB                  00531 LED_OFF:
00EB   8000           00532          call                            _OFF_LED
00EC                  00533 LEDScan:
00EC   6610           00534          incr                            ledScanCnt
00ED   3C04           00535          movai                           4
00EE   4010           00536          xorar                           ledScanCnt
00EF   E587           00537          jbset                           Z
00F0   000C           00538          return
00F1   7610           00539          clrr                            ledScanCnt
00F2   000C           00540          return
                      00541 
                      00542 
00F3                  00543 _MarqueeLED:
00F3   E20E           00544       jbset                           F_marquee500ms ;跑马灯 500ms一次
00F4   000C           00545       return
00F5   D20E           00546       bclr                            F_marquee500ms
00F6   D187           00547       bclr                            C
00F7   520F           00548       rlr                             ledFlags  ;寄存器R循环左移（带C标志），结果存到R
00F8   660F           00549       incr                            ledFlags
00F9   3C1F           00550       movai                           0x1f
00FA   480F           00551       rsubar                          ledFlags
00FB   E187           00552       jbset                           C      ;相减结果产生借位，则0→C；否则1→C
00FC   000C           00553       return          
00FD   5829           00554       movar                           marqueeLEDFlags
00FE   560F           00555       movra                           ledFlags
00FF   000C           00556       return
                      00557                                                                 
0100                  00558 _DisplayPrcess:
0100   E40D           00559          jbset                           F_chargeFull
0101   A000           00560          goto                            DisplayMode_1
0102   3C0F           00561          movai                           0xf
0103   560F           00562          movra                           ledFlags
0104   000C           00563          return
                      00564                                 
0105                  00565 DisplayMode_1: 
0105   3C01           00566         movai                           1 ;显示模式1
0106   4011           00567         xorar                           displayMode
0107   E587           00568         jbset                           Z      ;异或的结果为0，则1→Z；否则0→Z
0108   A000           00569         goto                            DisplayMode_2 
                      00570  ;=====================ceshi==================
0109   8000           00571         call                            _BrightLED1
                      00572         
                      00573         ;jbset                           F_power5V ;充电模式1
                      00574         ;goto                            LoadMode_1 
                      00575         ;movai                           0x0
                      00576         ;movra                           marqueeLEDFlags
                      00577         ;call                            _MarqueeLED
010A   000C           00578         return
                      00579                                 
010B                  00580 LoadMode_1: ;负载模式1
010B   E40C           00581         jbset                           F_load
010C   A000           00582         goto                            NoLoadMode_1 ;点亮LED1
010D   3C03           00583         movai                           3
010E   4809           00584         rsubar                          time_100ms
010F   F187           00585         jbclr                           C
0110   A000           00586         goto                            BlinkMode_1_OFF ;模式1 闪烁灭
0111   3C01           00587         movai                           0x1
0112   560F           00588         movra                           ledFlags
0113   000C           00589         return
0114                  00590 BlinkMode_1_OFF:        
0114   3C00           00591        movai                           0x0
0115   560F           00592        movra                           ledFlags
0116   000C           00593        return
                      00594 
                      00595                                 
0117                  00596 NoLoadMode_1: ;无负载模式1
0117   3C01           00597         movai                           0x1
0118   560F           00598         movra                           ledFlags
0119   000C           00599         return
                      00600 
011A                  00601 DisplayMode_2:
011A   3C02           00602       movai                           2
011B   4011           00603       xorar                           displayMode
011C   E587           00604       jbset                           Z
011D   A000           00605       goto                            DisplayMode_3
                      00606  ; ====================ceshi===========
011E   8000           00607       call                             _BrightLED2 
                      00608       ;jbset                           F_power5V ;充电模式2
                      00609       ;goto                            LoadMode_2 
                      00610       ;movai                           0x0
                      00611       ;movra                           marqueeLEDFlags
                      00612       ;call                            _MarqueeLED
011F   000C           00613       return
                      00614 
0120                  00615 LoadMode_2:
0120   E40C           00616       jbset                           F_load
0121   A000           00617       goto                            NoLoadMode_2
0122   EE0C           00618       jbset                           F_blink
0123   A000           00619       goto                            BlinkMode_2_OFF
0124   3C01           00620       movai                           0x1
0125   560F           00621       movra                           ledFlags
0126   000C           00622       return
                      00623       
0127                  00624 BlinkMode_2_OFF:
0127   3C00           00625          movai                           0x0
0128   560F           00626          movra                           ledFlags
0129   000C           00627          return
                      00628                                 
012A                  00629 NoLoadMode_2:
012A   3C01           00630        movai                           0x1
012B   560F           00631        movra                           ledFlags
012C   000C           00632        return
                      00633                 
012D                  00634 DisplayMode_3:
012D   3C03           00635            movai                           3
012E   4011           00636            xorar                           displayMode
012F   E587           00637            jbset                           Z
0130   A000           00638            goto                            DisplayMode_4 
                      00639  ;========================ceshi=========================
0131   8000           00640           call                             _BrightLED3 
                      00641            ;jbset                           F_power5V ;充电模式3
                      00642            ;goto                            LoadMode_3 
                      00643            ;movai                           0x1
                      00644            ;movra                           marqueeLEDFlags
                      00645            ;call                            _MarqueeLED
0132   000C           00646            return
                      00647 
0133                  00648 LoadMode_3:
0133   E40C           00649            jbset                           F_load
0134   A000           00650            goto                            NoLoadMode_3
0135   EE0C           00651            jbset                           F_blink
0136   A000           00652            goto                            BlinkMode_3_OFF
0137   3C03           00653            movai                           0x3
0138   560F           00654            movra                           ledFlags
0139   000C           00655            return
013A                  00656 BlinkMode_3_OFF:
013A   3C01           00657             movai                           0x1
013B   560F           00658             movra                           ledFlags
013C   000C           00659             return
                      00660              
013D                  00661 NoLoadMode_3:
013D   3C03           00662             movai                           0x3
013E   560F           00663             movra                           ledFlags
013F   000C           00664             return
                      00665 
0140                  00666 DisplayMode_4:
0140   3C04           00667         movai                           4
0141   4011           00668         xorar                           displayMode
0142   E587           00669         jbset                           Z
0143   A000           00670         goto                            DisplayMode_5
                      00671  ;=============ceshi=================
0144   8000           00672         call                             _BrightLED4
                      00673         ;jbset                           F_power5V ;充电模式3
                      00674         ;goto                            LoadMode_4 
                      00675         ;movai                           0x3
                      00676         ;movra                           marqueeLEDFlags
                      00677         ;call                            _MarqueeLED
0145   000C           00678         return
                      00679 
0146                  00680 LoadMode_4:
0146   E40C           00681            jbset                           F_load
0147   A000           00682            goto                            NoLoadMode_4
0148   EE0C           00683            jbset                           F_blink
0149   A000           00684            goto                            BlinkMode_4_OFF
014A   3C07           00685            movai                           0x7
014B   560F           00686            movra                           ledFlags
014C   000C           00687            return
014D                  00688 BlinkMode_4_OFF:
014D   3C03           00689              movai                           0x3
014E   560F           00690              movra                           ledFlags
014F   000C           00691              return
                      00692              
0150                  00693 NoLoadMode_4:
0150   3C07           00694              movai                           0x7
0151   560F           00695              movra                           ledFlags
0152   000C           00696              return
                      00697 
0153                  00698 DisplayMode_5:
0153   3C05           00699             movai                           5
0154   4011           00700             xorar                           displayMode
0155   E587           00701             jbset                           Z
0156   000C           00702             return
                      00703 
                      00704             ;jbset                           F_power5V ;充电模式3
                      00705             ;goto                            LoadMode_5 
                      00706             ;movai                           0x7
                      00707             ;movra                           marqueeLEDFlags
                      00708             ;call                            _MarqueeLED
0157   000C           00709             return
                      00710 
0158                  00711 LoadMode_5:
0158   E40C           00712             jbset                           F_load
0159   A000           00713             goto                            NoLoadMode_5
015A   EE0C           00714             jbset                           F_blink
015B   A000           00715             goto                            BlinkMode_5_OFF
015C   3C0F           00716             movai                           0xf
015D   560F           00717             movra                           ledFlags
015E   000C           00718             return
015F                  00719 BlinkMode_5_OFF:
015F   3C07           00720              movai                           0x7
0160   560F           00721              movra                           ledFlags
0161   000C           00722              return
                      00723              
0162                  00724 NoLoadMode_5:
0162   3C0F           00725              movai                           0xf
0163   560F           00726              movra                           ledFlags
0164   000C           00727              return
                      00728 ;=========end display=============
                      00729 
                      00730 ;===========AD检测=================
0165                  00731 _ADCSbr:
0165   57B0           00732      movra       ADCR0   ;0xb9  0x6d
0166   E3B0           00733      jbset       ADEOC   ;判断AD转换是否完毕
0167   A000           00734      goto        $-1     ;回到上一条指令     
0168   D187           00735      bclr        C
0169   7616           00736      clrr        adValue
016A   3C04           00737      movai       4
016B   5612           00738      movra       cycleCnt     
016C   59B4           00739      movar       ADRH
016D   5617           00740      movra       adValue+1   ;保存ADValue 高八位
016E                  00741 GetADValue:
016E   4E17           00742        rrr         adValue+1  ;寄存器R循环右移（带C标志），结果存到R  
016F   4E16           00743        rrr         adValue     ;ADValue 低八位
0170   6A12           00744        djzr        cycleCnt
0171   A000           00745        goto        GetADValue
0172   59B5           00746        movar       ADRL
0173   5E16           00747        orra        adValue    ;寄存器R内容和ACC或操作，结果存到R
0174   000C           00748        return
                      00749 
0175                  00750 _MultipleADSampling: ;连续8次AD值
0175   3C08           00751            movai       8
0176   5613           00752            movra       cycleCnt1
0177   7614           00753            clrr        sumAD
0178   7615           00754            clrr        sumAD+1
0179                  00755 ADSampling:
0179   5822           00756         movar       adChTemp ;   传递AD通道VOUT 
017A   8000           00757         call        _ADCSbr
017B   D187           00758         bclr        C
017C   5816           00759         movar       adValue
017D   7E14           00760         addra       sumAD
017E   5817           00761         movar       adValue+1
017F   1215           00762         adcra       sumAD+1
0180   6A13           00763         djzr        cycleCnt1
0181   A000           00764         goto        ADSampling
0182                  00765 Get_AD_AVG:  ;8次AD的平均值
0182   7620           00766           clrr        adAvg
0183   7621           00767           clrr        adAvg+1
0184   D187           00768           bclr        C
0185   3C03           00769           movai       3
0186   5612           00770           movra       cycleCnt
0187                  00771 Get_AD_AVG_1:
0187   4E15           00772          rrr         sumAD+1
0188   4E14           00773          rrr         sumAD
0189   D187           00774          bclr        C
018A   6A12           00775          djzr        cycleCnt
018B   A000           00776          goto        Get_AD_AVG_1
                      00777          
018C   5814           00778          movar       sumAD
018D   5620           00779          movra       adAvg
018E   5815           00780          movar       sumAD+1
018F   5621           00781          movra       adAvg+1
0190   000C           00782          return
                      00783 
0191                  00784 _BatSampleSbr:
0191   3CA9           00785          movai       BAT_ADCH ;   采电池电压(取样)
0192   5622           00786          movra       adChTemp
0193   8000           00787          call        _MultipleADSampling
0194   5820           00788          movar       adAvg
0195   5618           00789          movra       vbatAD
0196   5821           00790          movar       adAvg+1
0197   5619           00791          movra       vbatAD+1
0198   000C           00792          return
                      00793 
0199                  00794 _CurrentSampleSbr:
0199   3C59           00795            movai       CURRENT_ADCH ;电流采样
019A   5622           00796            movra       adChTemp
019B   8000           00797            call        _MultipleADSampling
019C   5820           00798            movar       adAvg
019D   561A           00799            movra       currentAD
019E   5821           00800            movar       adAvg+1
019F   561B           00801            movra       currentAD+1
01A0   000C           00802            return
                      00803 
01A1                  00804 _Boost5VSampleSbr:
01A1   3CB9           00805             movai       BOOST5V_ADCH ;升压5V采样
01A2   5622           00806             movra       adChTemp
01A3   8000           00807             call        _MultipleADSampling
01A4   5820           00808             movar       adAvg
01A5   561E           00809             movra       boostAD5V
01A6   5821           00810             movar       adAvg+1
01A7   561F           00811             movra       boostAD5V+1
01A8   000C           00812             return
                      00813 ;===============END AD==============
                      00814 
01A9                  00815 _Charging: ;充电中
01A9   F40D           00816             jbclr        F_chargeFull ;充满退出 1 充满
01AA   000C           00817             return     
01AB   E00D           00818             jbset        F_time10ms
01AC   000C           00819             return
01AD   D00D           00820             bclr         F_time10ms            
01AE   8000           00821             call         _BatSampleSbr                           
01AF   8000           00822             call         _CurrentSampleSbr            
01B0   3C04           00823             movai        4
01B1   4811           00824             rsubar      displayMode ; 显示模式>= 4后 才能判断充电是否已满
01B2   E187           00825             jbset        C
01B3   A000           00826              goto         AdjustChargePWM  ;调节充电PWM 
                      00827              ;===检测是否充满
01B4   3C08           00828              movai        low(SHUT_OFF_CURRENT_AD) ;检测充电电流是否小于关断值
01B5   481A           00829              rsubar       currentAD
01B6   3C00           00830              movai        high(SHUT_OFF_CURRENT_AD)
01B7   0C1B           00831              rsbcar       currentAD+1 ; <最小电流关断值
01B8   F187           00832              jbclr        C 
01B9   A000           00833              goto         DetectionChargeVBAT ; 检测充电电压 
01BA                  00834 BatteryFull:                                                                                      
01BA   6625           00835              incr         chargeFullCnt
01BB   3CFF           00836              movai        255
01BC   4025           00837              xorar        chargeFullCnt
01BD   E587           00838              jbset        Z
01BE   A000           00839              goto         BatteryFullOfCnt        ;充满计数
01BF   7625           00840              clrr         chargeFullCnt
01C0   6626           00841              incr         chargeFullCnt+1
01C1                  00842 BatteryFullOfCnt:
01C1   3C64           00843                movai      low(CHARGE_FULL_CNT)
01C2   4825           00844                rsubar     chargeFullCnt
01C3   3C00           00845                movai      high(CHARGE_FULL_CNT)
01C4   0C26           00846                rsbcar     chargeFullCnt+1
01C5   E187           00847                jbset      C                       
01C6   A000           00848                goto       AdjustChargePWM                         
01C7   C40D           00849                bset       F_chargeFull                    ;充电已满
01C8   DF98           00850                bclr       TC0EN                           ;停掉PWM
01C9   DD98           00851                bclr       PWM0OE  
01CA   CD94           00852                bset       PMOS
01CB   000C           00853                return
                      00854                                 
01CC                  00855 DetectionChargeVBAT:                                                            
01CC   3C42           00856                movai       low(FULL_VOLTAGE_AD)
01CD   4818           00857                rsubar      vbatAD
01CE   3C09           00858                movai       high(FULL_VOLTAGE_AD)
01CF   0C19           00859                rsbcar      vbatAD+1
01D0   E187           00860                jbset       C 
01D1   A000           00861                goto        BatteryNotFull                  
01D2   A000           00862                goto        BatteryFull                                     
01D3                  00863 BatteryNotFull:                                            
01D3   7625           00864                clrr        chargeFullCnt
01D4   7626           00865                clrr        chargeFullCnt+1
                      00866 
01D5                  00867 AdjustChargePWM:                                                                                                                        
01D5   3C00           00868       movai     low(LOW_VBAT_AD) ; 判断给0V电池充电 需一直小PWM
01D6   4818           00869       rsubar    vbatAD
01D7   3C05           00870       movai     high(LOW_VBAT_AD)
01D8   0C19           00871       rsbcar    vbatAD+1
01D9   F187           00872       jbclr     C
01DA   A000           00873       goto      VBATDaYu3V
01DB   3C62           00874       movai     98    ;电池电压小于3v时以小PWM充电
01DC   579B           00875       movra     T0DATA
01DD   A000           00876       goto      ChargeVBAT_Compare                                                      
                      00877                                                                 
01DE                  00878 VBATDaYu3V: ;电池电压高
01DE   3C10           00879       movai      low(CONST_VOLTAGE_AD)
01DF   4818           00880       rsubar     vbatAD
01E0   3C09           00881       movai      high(CONST_VOLTAGE_AD)
01E1   0C19           00882       rsbcar     vbatAD+1
01E2   E187           00883       jbset      C
01E3   A000           00884       goto       DetectionChargeCurrent                                          
                      00885                                                         
01E4                  00886 ChargePWM_UP: ;充电用的是PMOS 占空比越大 电流越小
01E4   3C62           00887      movai       CHARGE_PWM_DUTY_MAX
01E5   499B           00888      rsubar      T0DATA                                                                                                                                  
01E6   F187           00889      jbclr       C
01E7   A000           00890      goto        ChargeVBAT_Compare
01E8   679B           00891      incr        T0DATA                                                                                          
01E9   A000           00892      goto        ChargeVBAT_Compare                                                                              
                      00893                                                         
01EA                  00894 DetectionChargeCurrent:                                                                                                                                 
01EA   3C52           00895     movai        low(CONST_CURRENT_AD)
01EB   481A           00896     rsubar       currentAD
01EC   3C00           00897     movai        high(CONST_CURRENT_AD)
01ED   0C1B           00898     rsbcar       currentAD+1
01EE   F187           00899     jbclr        C
01EF   A000           00900     goto         ChargePWM_UP
                      00901 
01F0                  00902 ChargePWM_DOWN: 
01F0   3C0A           00903      movai          CHARGE_PWM_DUTY_MIN
01F1   499B           00904      rsubar         T0DATA                                                                                                                          
01F2   E187           00905      jbset          C
01F3   A000           00906      goto           ChargeVBAT_Compare                                                                                              
01F4   6F9B           00907      decr           T0DATA                                                                                                                                                                  
                      00908                         
01F5                  00909 ChargeVBAT_Compare:                                                                                                                                                                                     
01F5   581C           00910      movar      lastAD
01F6   4818           00911      rsubar     vbatAD
01F7   581D           00912      movar      lastAD+1
01F8   0C19           00913      rsbcar     vbatAD+1
01F9   E187           00914      jbset       C
01FA   000C           00915      return     
01FB   8000           00916      call        _BatteryMode
01FC   5818           00917      movar       vbatAD
01FD   561C           00918      movra       lastAD
01FE   5819           00919      movar       vbatAD+1
01FF   561D           00920      movra       lastAD+1
0200   000C           00921      return
                      00922 
0201                  00923 _Boost:
0201   3CAA           00924     movai           low(BOOST_5V_CONST_AD)
0202   481E           00925     rsubar          boostAD5V
0203   3C0A           00926     movai           high(BOOST_5V_CONST_AD)
0204   0C1F           00927     rsbcar          boostAD5V+1
0205   F187           00928     jbclr           C ;<设定值 加大PWM
0206   A000           00929     goto            BoostPWM_DOWN                                                                                       
0207   3C19           00930     movai          BOOST_PWM_DUTY_MAX
0208   499F           00931     rsubar         T1DATA                                                                                                                          
0209   F187           00932     jbclr          C
020A   000C           00933     return                  
020B   679F           00934     incr           T1DATA                                                                                                                                  
020C   000C           00935     return                          
                      00936                                 
020D                  00937 BoostPWM_DOWN:                                                                                                                                                  
020D   3C02           00938      movai          BOOST_PWM_DUTY_MIN
020E   499F           00939      rsubar         T1DATA                                                                                                                          
020F   E187           00940      jbset           C                                                                                                                                                               
0210   000C           00941      return                 
0211   6F9F           00942      decr           T1DATA                                                                                                                                          
0212   000C           00943      return
                      00944                                         
0213                  00945 _DetLoad:               
                      00946 
0213   3C00           00947       movai        low(LOW_VBAT_AD)
0214   4818           00948       rsubar       vbatAD
0215   3C05           00949       movai        high(LOW_VBAT_AD)
0216   0C19           00950       rsbcar       vbatAD+1
0217   E187           00951       jbset        C
0218   A000           00952       goto         LowVbat ; 电池电压低于3V      
0219   EA0D           00953       jbset        F_detLoad
021A   000C           00954       return      
021B   E20D           00955       jbset        F_time100ms
021C   000C           00956       return
021D   D20D           00957       bclr         F_time100ms              
021E   8000           00958       call       _CurrentSampleSbr         
021F   3CBC           00959       movai       low(LOAD_CURRENT_AD_MAX)
0220   481A           00960       rsubar      currentAD
0221   3C00           00961       movai       high(LOAD_CURRENT_AD_MAX)
0222   0C1B           00962       rsbcar      currentAD+1
0223   F187           00963       jbclr       C ;debug
0224   A000           00964       goto        NoLoad
                      00965       ;jbset     C ; >限流值
                      00966       ;goto      NoOverCurrent ;没有过流 
                      00967       ;bclr      F_detLoad ;停止检测负载 关机
                      00968       ;bclr      F_load
                      00969       ;bclr      BOOST_EN
                      00970       ;bset      F_sleep
                      00971       ;return
                      00972                                 
0225                  00973 NoOverCurrent: 
0225   3C08           00974          movai         low(LOAD_CURRENT_AD_MIN)
0226   481A           00975          rsubar        currentAD
0227   3C00           00976          movai         high(LOAD_CURRENT_AD_MIN)
0228   0C1B           00977          rsbcar        currentAD+1
0229   E187           00978          jbset         C ; >最小值
022A   A000           00979          goto          NoLoad
022B   7624           00980          clrr          noLoadCnt
022C   6623           00981          incr          loadCnt
022D   3C05           00982          movai         LOAD_CNT
022E   4023           00983          xorar         loadCnt
022F   E587           00984          jbset         Z
0230   000C           00985          return
0231   C40C           00986          bset          F_load
0232   000C           00987          return
                      00988          
0233                  00989 NoLoad:
0233   7623           00990          clrr      loadCnt
0234   6624           00991          incr      noLoadCnt
0235   3C05           00992          movai     NO_LOAD_CNT
0236   4024           00993          xorar     noLoadCnt
0237   E587           00994          jbset     Z
0238   000C           00995          return
0239   D40C           00996          bclr      F_load
023A   000C           00997          return
                      00998                                 
023B                  00999 LowVbat: ;电池没电
023B   DB90           01000        bclr      BOOST_EN
023C   D40C           01001        bclr      F_load
023D   D00E           01002        bclr      F_noLoadState
023E   DF9C           01003        bclr      TC1EN ;关升压PWM
023F   DD9C           01004        bclr      PWM1OE
0240   DF94           01005        bclr      NMOS
                      01006                 
0241   DE0D           01007        bclr      F_displayEn      ;关显示   
0242   DB94           01008        bclr      LED12
0243   D994           01009        bclr      LED34
                      01010        ;bclr      LEDCOM
0244   CB95           01011        bset      DDR1,5
0245   C995           01012        bset      DDR1,4
0246   C80C           01013        bset      F_sleep
0247   000C           01014        return
                      01015                                 
0248                  01016 _OffDisplay: ;关显示
0248   DE0D           01017           bclr     F_displayEn
0249   CB94           01018           bset     LED12     ;25%
024A   C994           01019           bset     LED34     ;50%
024B   C194           01020           bset     LED56     ;75%
024C   C790           01021           bset     LED78     ;100%
                      01022           ;BCLR     LEDCOM
024D   CB95           01023           bset     DDR1,5    ;  
024E   C995           01024           bset     DDR1,4    ;
024F   C195           01025           bset     DDR1,0    ;  
0250   C791           01026           bset     DDR0,3    ;
0251   000C           01027           return
                      01028 
0252                  01029 _OffPMOS:
0252   DF98           01030           bclr     TC0EN
0253   DD98           01031           bclr     PWM0OE  
0254   CD94           01032           bset     PMOS
0255   000C           01033           return
                      01034 
0256                  01035 _OffNMOS:
0256   DF9C           01036           bclr     TC1EN ;关PWM
0257   DD9C           01037           bclr     PWM1OE
0258   DFAC           01038           bclr     PWMCR0,7
0259   DBAC           01039           bclr     PWMCR0,5
025A   D9AC           01040           bclr     PWMCR0,4
025B   DF94           01041           bclr     NMOS
025C   000C           01042           return
                      01043 
025D                  01044 START:
                      01045           ;call         _Delay
025D   8000           01046           call        _InitRst
025E   8000           01047           call        _InitRAM
025F   CF88           01048           bset        GIE          
                      01049           ;bset        LIGHT_LED
0260   CE0D           01050           bset        F_displayEn
                      01051           ;movai       0xf
                      01052           ;movra       ledFlags          
                      01053           ;movai        30
                      01054           ;movra        loopCnt
0261                  01055 LoopDelay:
                      01056         ;call           _Delay
                      01057         ;djzr           loopCnt
                      01058         ;goto           LoopDelay        
                      01059         ;bclr           LIGHT_LED      ;照明灯
                      01060         ;bclr           F_displayEn    ;显示使能
                      01061         ;call           _OffDisplay
                      01062         ;clrr           ledFlags        
                      01063         ;call           _Delay        
0261   8000           01064         call           _BatSampleSbr
0262   5818           01065         movar          vbatAD
0263   561C           01066         movra          lastAD
0264   5819           01067         movar          vbatAD+1
0265   561D           01068         movra          lastAD+1
0266   8000           01069         call           _BatteryMode
                      01070        ; call           _DisplayPrcess
0267   8000           01071         call           DisplayMode_1
0268   A000           01072         goto           LoopDelay
                      01073         
                      01074 ;main:
                      01075 ;        call           _Boost5VSampleSbr
                      01076 ;        ;call          _CurrentSampleSbr
                      01077 ;        ;call          _BatSampleSbr
                      01078 ;        call           _TimeBase
                      01079 ;        call           _KeyScan
                      01080 ;        call           _KeyDeal
                      01081                                 
                      01082 ;LongKeyProcess:
                      01083 ;              movai     LONG_KEY
                      01084 ;              xorar     keyCode
                      01085 ;              jbset     Z
                      01086 ;              goto      ShortKeyProcess 
                      01087 ;              jbclr     F_lightSwitch   
                      01088 ;              goto      GuanZhaoMing            
                      01089 ;              bset      F_lightSwitch
                      01090 ;              bset      LIGHT_LED
                      01091 ;              goto      JianChePower5v
                      01092 ;              
                      01093 ;GuanZhaoMing:
                      01094 ;              bclr      F_lightSwitch
                      01095 ;              bclr      LIGHT_LED
                      01096 ;              goto      JianChePower5v
                      01097 ;                                
                      01098 ;ShortKeyProcess:        
                      01099 ;           movai      SHORT_KEY
                      01100 ;           xorar      keyCode
                      01101 ;           jbset      Z
                      01102 ;           goto       JianChePower5v
                      01103 ;           
                      01104 ;           jbclr      F_power5V
                      01105 ;           goto       JianChePower5v
                      01106 ;           jbclr      F_load
                      01107 ;           goto       JianChePower5v
                      01108 ;           
                      01109 ;           clrr       sleepTime  
                      01110 ;           clrr       loadCnt 
                      01111 ;           clrr       noLoadCnt
                      01112 ;
                      01113 ;           movai      1
                      01114 ;           movra      T1DATA
                      01115 ;
                      01116 ;           movai      0xb0 ;升压PWM设置 开启bit7 bit6 
                      01117 ;           movra      PWMCR0
                      01118 ;           bset       PWM1OE
                      01119 ;           bset       TC1EN
                      01120 ;           
                      01121 ;           bset       BOOST_EN
                      01122 ;           bset       F_detLoad ; 可以检测负载
                      01123 ;           bset       F_displayEn ; 开显示
                      01124 ;           bset       F_noLoadState
                      01125 ;        
                      01126 ;JianChePower5v:                 
                      01127 ;            jbset      CHRG  ;为高表示有5V接入
                      01128 ;            goto       NoPower5V
                      01129 ;            jbclr      F_power5V
                      01130 ;            goto       Charge_Discharge_Process ;充放电处理
                      01131 ;            incr       filterCnt ; 5V接入去抖动
                      01132 ;            movai      100
                      01133 ;            xorar      filterCnt
                      01134 ;            jbset      Z
                      01135 ;            goto       Charge_Discharge_Process
                      01136 ;            clrr       filterCnt
                      01137 ;            
                      01138 ;            bset       F_power5V
                      01139 ;            clrr       sleepTime
                      01140 ;            
                      01141 ;            bclr       F_load ; 关放电部分
                      01142 ;            bclr       F_detLoad
                      01143 ;            bclr       F_noLoadState
                      01144 ;            bclr       BOOST_EN
                      01145 ;            
                      01146 ;            call       _OffNMOS
                      01147 ;            
                      01148 ;            bset       F_displayEn ; 开显示使能
                      01149 ;            
                      01150 ;            movai      98 ;  赋初始值
                      01151 ;            movra      T0DATA
                      01152 ;            bset       TC0EN ; 开启PMOS
                      01153 ;            bset       PWM0OE  
                      01154 ;            goto       Charge_Discharge_Process ;充放电过程
                      01155 ;            
                      01156 ;NoPower5V:
                      01157 ;            call       _DetLoad
                      01158 ;            jbset      F_power5V
                      01159 ;            goto       Charge_Discharge_Process
                      01160 ;            bclr       F_power5V
                      01161 ;            bclr       F_chargeFull
                      01162 ;            clrr       filterCnt
                      01163 ;            call       _OffPMOS
                      01164 ;            call       _OffDisplay
                      01165 ;                                
                      01166 ;Charge_Discharge_Process:
                      01167 ;                   jbset      F_power5V ;充电
                      01168 ;                   goto       DischargeProcess ;放电过程
                      01169 ;                   call       _Charging
                      01170 ;                   goto       Dispaly 
                      01171 ;                                
                      01172 ;DischargeProcess: ;放电
                      01173 ;               jbset      F_load
                      01174 ;               goto       NoLoadState               
                      01175 ;               clrr       sleepTime               
                      01176 ;               jbset      F_time500ms
                      01177 ;               goto       BoostStatus 
                      01178 ;               bclr       F_time500ms                             
                      01179 ;               call       _BatSampleSbr                          
                      01180 ;               movar      lastAD
                      01181 ;               rsubar     vbatAD
                      01182 ;               movar      lastAD+1
                      01183 ;               rsbcar     vbatAD+1
                      01184 ;               jbclr       C 
                      01185 ;               goto        BoostStatus 
                      01186 ;               call        _BatteryMode
                      01187 ;               movar       vbatAD
                      01188 ;               movra       lastAD
                      01189 ;               movar       vbatAD+1
                      01190 ;               movra       lastAD+1
                      01191 ;               
                      01192 ;BoostStatus: 
                      01193 ;               call        _Boost
                      01194 ;               goto        Dispaly 
                      01195 ;NoLoadState:
                      01196 ;         jbclr       F_noLoadState
                      01197 ;         goto        BoostStatus 
                      01198         
                      01199 ;Dispaly:
                      01200 ;         jbset       F_displayEn
                      01201 ;         goto        ToSleep
                      01202 ;         call        _DisplayPrcess
                      01203 
                      01204 ;ToSleep:
                      01205 ;         jbset      F_sleep
                      01206 ;         goto       main
                      01207 ;         bclr       F_sleep
                      01208 ;         bclr       F_detLoad
                      01209 ;         bclr       F_noLoadState
                      01210 ;         bclr       BOOST_EN
                      01211 ;         bclr       TC0EN
                      01212 ;         bclr       PWM0OE
                      01213 ;         bclr       TC1EN     ;关PWM
                      01214 ;         bclr       PWM1OE
                      01215 ;         bclr       PWMCR0,7
                      01216 ;         bclr       PWMCR0,5
                      01217 ;         bclr       PWMCR0,4
                      01218 ;         bset       PMOS
                      01219 ;         bclr       NMOS
                      01220 ;         bclr       F_displayEn             
                      01221 ;         bclr       LED12
                      01222 ;         bclr       LED34
                      01223 ;         bclr       LEDCOM
                      01224 ;         bset       DDR1,5
                      01225 ;         bset       DDR1,4         
                      01226 ;         bset       KBIE
                      01227 ;         bclr       P1,6
                      01228 ;         nop
                      01229 ;         nop
                      01230 ;         nop
                      01231 ;         stop
                      01232 ;         nop
                      01233 ;         nop
                      01234 ;         nop
                      01235 ;         bclr       KBIE
                      01236 ;         nop
                      01237 ;         clrr       currentAD
                      01238 ;         clrr       currentAD+1
                      01239 ;         goto       main         
                      01240          en
gpasm-1.7.0_beta1 (Feb  6 2015)D:\ZMJWork\project\MC32P7311\luozheng_demo\zmj7311\Mobile_BAT\mobile_bat0715_step.asm2015-7-22  11:32:13          PAGE  2


SYMBOL TABLE
  LABEL                             VALUE

ADCR0                             000001B0
ADCR1                             000001B1
ADCR2                             000001B2
ADRH                              000001B4
ADRL                              000001B5
ADSampling                        00000179
ANSEL0                            000001B6
ANSEL1                            000001B7
AdjustChargePWM                   000001D5
BatteryFull                       000001BA
BatteryFullOfCnt                  000001C1
BatteryNotFull                    000001D3
Battery_MODE_1                    00000090
Battery_MODE_2                    00000098
Battery_MODE_3                    000000A0
Battery_MODE_4                    000000A8
BlinkMode_1_OFF                   00000114
BlinkMode_2_OFF                   00000127
BlinkMode_3_OFF                   0000013A
BlinkMode_4_OFF                   0000014D
BlinkMode_5_OFF                   0000015F
BoostPWM_DOWN                     0000020D
ChargePWM_DOWN                    000001F0
ChargePWM_UP                      000001E4
ChargeVBAT_Compare                000001F5
DRVCR0                            0000018C
DRVCR1                            0000018D
DelayCnt                          00000002
DelayCnt1                         00000003
Delay_1                           00000062
Delay_2                           00000064
DetectionChargeCurrent            000001EA
DetectionChargeVBAT               000001CC
DisplayLED2                       000000CD
DisplayLED3                       000000D7
DisplayLED4                       000000E1
DisplayMode_1                     00000105
DisplayMode_2                     0000011A
DisplayMode_3                     0000012D
DisplayMode_4                     00000140
DisplayMode_5                     00000153
ExitInterrupt                     00000028
Exit_Battery_MODE                 000000A9
FSR0                              00000184
FSR1                              00000185
Flag                              0000000C
Flag1                             0000000D
Flag2                             0000000E
GetADValue                        0000016E
Get_AD_AVG                        00000182
Get_AD_AVG_1                      00000187
HIBYTE                            00000183
INDF0                             00000180
INDF1                             00000181
INDF2                             00000182
INDF3                             00000189
INT0_IRQ                          0000001F
INT1_IRQ                          00000022
INTE                              0000018A
INTF                              0000018B
IOP0                              00000190
IOP1                              00000194
InitRAM0                          00000059
InterruptVector                   00000008
KBCR                              0000018E
KBIM_IRQ                          00000025
LEDScan                           000000EC
LED_OFF                           000000EB
LVDCR                             000001AF
LoadMode_1                        0000010B
LoadMode_2                        00000120
LoadMode_3                        00000133
LoadMode_4                        00000146
LoadMode_5                        00000158
LoopDelay                         00000261
LowVbat                           0000023B
MCR                               00000188
NoLoad                            00000233
NoLoadMode_1                      00000117
NoLoadMode_2                      0000012A
NoLoadMode_3                      0000013D
NoLoadMode_4                      00000150
NoLoadMode_5                      00000162
NoOverCurrent                     00000225
OEP0                              00000191
OEP1                              00000195
OSCCAL                            000001FB
OSCM                              000001AE
PCL                               00000186
PDP0                              00000193
PDP1                              00000197
PFLAG                             00000187
PUP0                              00000192
PUP1                              00000196
PWMCR0                            000001AC
PWMCR1                            000001AD
START                             0000025D
T0CNT                             00000199
T0CR                              00000198
T0DATA                            0000019B
T0DE                              000001A8
T0LOAD                            0000019A
T1CNT                             0000019D
T1CR                              0000019C
T1DATA                            0000019F
T1DE                              000001A9
T1LOAD                            0000019E
T2CNT                             000001A1
T2CR                              000001A0
T2DATA                            000001A3
T2DE                              000001AA
T2LOAD                            000001A2
T3CNT                             000001A5
T3CR                              000001A4
T3LOAD                            000001A6
TIM0_IRQ                          0000000B
TIM1_IRQ                          0000000E
TIM2_IRQ                          00000011
TimeAccumulation                  00000018
VBATDaYu3V                        000001DE
_.org_8_0167                      00000167
_ADCSbr                           00000165
_BatSampleSbr                     00000191
_BatteryMode                      00000088
_Boost                            00000201
_Boost5VSampleSbr                 000001A1
_BrightLED1                       000000AB
_BrightLED2                       000000B0
_BrightLED3                       000000B5
_BrightLED4                       000000BA
_Charging                         000001A9
_CurrentSampleSbr                 00000199
_Delay                            00000060
_DetLoad                          00000213
_DisplayLED                       000000C4
_DisplayPrcess                    00000100
_InitRAM                          00000058
_InitRst                          0000002C
_MarqueeLED                       000000F3
_MultipleADSampling               00000175
_OFF_LED                          000000BF
_OffDisplay                       00000248
_OffNMOS                          00000256
_OffPMOS                          00000252
_TimeBase                         00000069
__32P21                           00000001
accTemp                           00000000
adAvg                             00000020
adChTemp                          00000022
adValue                           00000016
boostAD5V                         0000001E
chargeFullCnt                     00000025
currentAD                         0000001A
cycleCnt                          00000012
cycleCnt1                         00000013
displayMode                       00000011
dutyBoostCnt                      00000027
dutyChargeCnt                     00000026
filterCnt                         00000028
keyCode                           00000004
keyFilterTime                     00000005
keyPressTime                      00000006
lastAD                            0000001C
ledFlags                          0000000F
ledScanCnt                        00000010
loadCnt                           00000023
loopCnt                           0000002A
marqueeLEDFlags                   00000029
noLoadCnt                         00000024
sleepTime                         0000000B
statusTemp                        00000001
sumAD                             00000014
time_100ms                        00000009
time_10ms                         00000008
time_1ms                          00000007
time_500ms                        0000000A
vbatAD                            00000018
ADEOC                             ADCR0,1
ADIE                              INTE,6
ADIF                              INTF,6
ADON                              ADCR0,0
AIN0                              0<<4
AIN1                              1<<4
AIN2                              2<<4
AIN3                              3<<4
AIN4                              4<<4
AIN5                              5<<4
BAT_ADCH                          0xa9
BOOST5V_ADCH                      0xb9
BOOST_5V_CONST_AD                 2730
BOOST_EN                          P0,5
BOOST_PWM_DUTY_MAX                25
BOOST_PWM_DUTY_MIN                2
BUZ0OE                            T0CR,5
BUZ1OE                            T1CR,5
BUZ2OE                            T2CR,5
C                                 PFLAG,0
CHARGE_FULL_CNT                   100
CHARGE_PWM_DUTY_MAX               98
CHARGE_PWM_DUTY_MIN               10
CHRG                              P1,1
CLKS                              OSCM,2
CONST_CURRENT_AD                  82
CONST_VOLTAGE_AD                  2320
CURRENT_ADCH                      0x59
DC                                PFLAG,1
DD00                              DDR0,0
DD01                              DDR0,1
DD02                              DDR0,2
DD03                              DDR0,3
DD04                              DDR0,4
DD05                              DDR0,5
DD10                              DDR1,0
DD11                              DDR1,1
DD12                              DDR1,2
DD13                              DDR1,3
DD14                              DDR1,4
DD15                              DDR1,5
DD16                              DDR1,6
DD17                              DDR1,7
DDR0                              OEP0
DDR1                              OEP1
DET_CURRENT                       P0,2
FSR                               FSR0
FSYS_DIV16                        0<<2
FSYS_DIV2                         3<<2
FSYS_DIV4                         2<<2
FSYS_DIV8                         1<<2
FULL_VOLTAGE_AD                   2370
F_blink                           Flag,7
F_chargeFull                      Flag1,2
F_detLoad                         Flag1,5
F_displayEn                       Flag1,7
F_keyRelease                      Flag,0
F_keyValid                        Flag,1
F_ledOff                          Flag,5
F_lightSwitch                     Flag1,6
F_load                            Flag,2
F_marquee500ms                    Flag2,1
F_noLoadState                     Flag2,0
F_power5V                         Flag,3
F_preCharge                       Flag1,3
F_showVBAT                        Flag,6
F_sleep                           Flag,4
F_time100ms                       Flag1,1
F_time10ms                        Flag1,0
F_time500ms                       Flag1,4
GIE                               MCR,7
HFEN                              OSCM,0
INDF                              INDF0
INT0IE                            INTE,2
INT0IF                            INTF,2
INT1IE                            INTE,3
INT1IF                            INTF,3
INTECON                           INTE
KBIE                              INTE,4
KBIF                              INTF,4
KEY_EFFECT                        100
KEY_I                             P1,3
LED12                             P1,5
LED34                             P1,4
LED56                             P1,0
LED78                             P0,3
LFEN                              OSCM,1
LIGHT_LED                         P1,0
LOAD_CNT                          5
LOAD_CURRENT_AD_MAX               188
LOAD_CURRENT_AD_MIN               8
LONG_KEY                          2
LOW_VBAT_AD                       1280
MINT00                            MCR,0
MINT01                            MCR,1
MINT10                            MCR,2
MINT11                            MCR,3
NMOS                              P1,7
NO_KEY                            0
NO_LOAD_CNT                       5
P0                                IOP0
P00                               P0,0
P01                               P0,1
P02                               P0,2
P03                               P0,3
P04                               P0,4
P05                               P0,5
P0HCON                            PUP0
P1                                IOP1
P10                               P1,0
P11                               P1,1
P12                               P1,2
P13                               P1,3
P14                               P1,4
P15                               P1,5
P16                               P1,6
P17                               P1,7
P1HCON                            PUP1
PD                                MCR,4
PMOS                              P1,6
PWM0OE                            T0CR,6
PWM1OE                            T1CR,6
PWM2OUT                           T2CR,6
RESS0                             ADCR1,3
SHORT_CIRCUIT_AD                  400
SHORT_KEY                         1
SHUT_OFF_CURRENT_AD               8
STATUS                            PFLAG
STBH                              OSCM,4
STBL                              OSCM,5
T0                                MCR,5
T0IE                              INTE,0
T0IF                              INTF,0
T0PR0                             T0CR,0
T0PR1                             T0CR,1
T0PR2                             T0CR,2
T0PS0                             T0CR,3
T0PS1                             T0CR,4
T1IE                              INTE,1
T1IF                              INTF,1
T1PR0                             T1CR,0
T1PR1                             T1CR,1
T1PR2                             T1CR,2
T1PS0                             T1CR,3
T1PS1                             T1CR,4
T2IE                              INTE,5
T2IF                              INTF,5
T2PR0                             T2CR,0
T2PR1                             T2CR,1
T2PR2                             T2CR,2
T2PS0                             T2CR,3
T2PS1                             T2CR,4
T3PR0                             T3CR,0
T3PR1                             T3CR,1
T3PR2                             T3CR,2
T3PS0                             T3CR,3
T3PS1                             T3CR,4
TC0EN                             T0CR,7
TC1EN                             T1CR,7
TC2EN                             T2CR,7
TC3EN                             T3CR,7
VBAT_AD0                          1365
VBAT_AD1                          1493
VBAT_AD2                          1600
VBAT_AD3                          1664
VDD_DIV3                          6<<4
VOUTV_DIV3                        7<<4
VREF                              P0,4
VRS0                              ADCR1,0
VRS1                              ADCR1,1
VRS2                              ADCR1,2
Z                                 PFLAG,2

Errors   :     0
Warnings :     0 reported,     0 suppressed
Messages :     0 reported,     0 suppressed

