gpasm-1.7.0_beta1 (Feb  6 2015)D:\ZMJWork\project\MC32P7311\luozheng_demo\zmj7311\Mobile_BAT\mobile_bat0717_new.asm2015-7-30  17:38:24          PAGE  1


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00001 ;仿真时FCPU=4M；    外灌时钟8M 4T 
                      00002 ;AD基准电压是内参2V
                      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     0x180
  00000181            00010 INDF1   EQU     0x181
  00000182            00011 INDF2   EQU     0x182
  00000183            00012 HIBYTE  EQU     0x183
  00000184            00013 FSR0    EQU     0x184
  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 DRVCR   EQU     0x18C
  0000018E            00022 KBCR    EQU     0x18E
                      00023 
  00000190            00024 IOP0    EQU     0x190
  00000191            00025 OEP0    EQU     0x191
  00000192            00026 PUP0    EQU     0x192
  00000193            00027 PDP0    EQU     0x193
  00000194            00028 IOP1    EQU     0x194
  00000195            00029 OEP1    EQU     0x195
  00000196            00030 PUP1    EQU     0x196
  00000197            00031 PDP1    EQU     0x197
                      00032 
  00000198            00033 T0CR    EQU     0x198
  00000199            00034 T0CNT   EQU     0x199
  0000019A            00035 T0LOAD  EQU     0x19A
  0000019B            00036 T0DATA  EQU     0x19B
  0000019C            00037 T1CR    EQU     0x19C
  0000019D            00038 T1CNT   EQU     0x19D
  0000019E            00039 T1LOAD  EQU     0x19E
  0000019F            00040 T1DATA  EQU     0x19F
                      00041 
  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 PWM0DE  EQU     0x1A8
  000001A9            00051 PWM1DE  EQU     0x1A9
  000001AA            00052 PWM2DE  EQU     0x1AA
  000001AC            00053 PWMCR0  EQU     0x1AC
  000001AD            00054 PWMCR1  EQU     0x1AD
  000001AE            00055 OSCM    EQU     0x1AE
  000001AF            00056 LVDCR   EQU     0x1AF
                      00057 
  000001B0            00058 ADCR0   EQU     0x1B0
  000001B1            00059 ADCR1   EQU     0x1B1
  000001B2            00060 ADCR2   EQU     0x1B2
                      00061 
  000001B4            00062 ADRH    EQU     0x1B4
  000001B5            00063 ADRL    EQU     0x1B5
  000001B6            00064 ANSEL0  EQU     0x1B6
  000001B7            00065 ANSEL1  EQU     0x1B7
                      00066 
  000001F8            00067 VBGCAL  EQU     0x1F8
  000001FB            00068 OSCCAL1 EQU     0x1FB
  000001FC            00069 OSCCAL0 EQU     0x1FC
                      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 #define         INTFLAG         INTF    
                      00078 
                      00079 
                      00080 ;INDF0
                      00081 #define         INDF07          INDF0,7
                      00082 #define         INDF06          INDF0,6
                      00083 #define         INDF05          INDF0,5
                      00084 #define         INDF04          INDF0,4
                      00085 #define         INDF03          INDF0,3
                      00086 #define         INDF02          INDF0,2
                      00087 #define         INDF01          INDF0,1
                      00088 #define         INDF00          INDF0,0
                      00089 
                      00090 ;INDF1
                      00091 #define         INDF17          INDF1,7
                      00092 #define         INDF16          INDF1,6
                      00093 #define         INDF15          INDF1,5
                      00094 #define         INDF14          INDF1,4
                      00095 #define         INDF13          INDF1,3
                      00096 #define         INDF12          INDF1,2
                      00097 #define         INDF11          INDF1,1
                      00098 #define         INDF10          INDF1,0
                      00099 
                      00100 ;INDF2
                      00101 #define         INDF27          INDF2,7
                      00102 #define         INDF26          INDF2,6
                      00103 #define         INDF25          INDF2,5
                      00104 #define         INDF24          INDF2,4
                      00105 #define         INDF23          INDF2,3
                      00106 #define         INDF22          INDF2,2
                      00107 #define         INDF21          INDF2,1
                      00108 #define         INDF20          INDF2,0
                      00109 
                      00110 ;HIBYTE
                      00111 #define         HIBYTE7         HIBYTE,7
                      00112 #define         HIBYTE6         HIBYTE,6
                      00113 #define         HIBYTE5         HIBYTE,5
                      00114 #define         HIBYTE4         HIBYTE,4
                      00115 #define         HIBYTE3         HIBYTE,3
                      00116 #define         HIBYTE2         HIBYTE,2
                      00117 #define         HIBYTE1         HIBYTE,1
                      00118 #define         HIBYTE0         HIBYTE,0
                      00119 
                      00120 ;FSR0
                      00121 #define         FSR07           FSR0,7
                      00122 #define         FSR06           FSR0,6
                      00123 #define         FSR05           FSR0,5
                      00124 #define         FSR04           FSR0,4
                      00125 #define         FSR03           FSR0,3
                      00126 #define         FSR02           FSR0,2
                      00127 #define         FSR01           FSR0,1
                      00128 #define         FSR00           FSR0,0
                      00129 
                      00130 ;FSR1
                      00131 #define         FSR17           FSR1,7
                      00132 #define         FSR16           FSR1,6
                      00133 #define         FSR15           FSR1,5
                      00134 #define         FSR14           FSR1,4
                      00135 #define         FSR13           FSR1,3
                      00136 #define         FSR12           FSR1,2
                      00137 #define         FSR11           FSR1,1
                      00138 #define         FSR10           FSR1,0
                      00139 
                      00140 ;PCL
                      00141 #define         PC7             PCL,7
                      00142 #define         PC6             PCL,6
                      00143 #define         PC5             PCL,5
                      00144 #define         PC4             PCL,4
                      00145 #define         PC3             PCL,3
                      00146 #define         PC2             PCL,2
                      00147 #define         PC1             PCL,1
                      00148 #define         PC0             PCL,0
                      00149 
                      00150 ;pflag bit 
                      00151 #define         Z               PFLAG,2
                      00152 #define         DC              PFLAG,1
                      00153 #define         C               PFLAG,0
                      00154 
                      00155 ;MCR 
                      00156 #define         GIE             MCR,7
                      00157 #define         T0              MCR,5
                      00158 #define         PD              MCR,4
                      00159 #define         MINT11          MCR,3
                      00160 #define         MINT10          MCR,2
                      00161 #define         MINT01          MCR,1
                      00162 #define         MINT00          MCR,0
                      00163 
                      00164 ;INDF3
                      00165 #define         INDF37          INDF3,7
                      00166 #define         INDF36          INDF3,6
                      00167 #define         INDF35          INDF3,5
                      00168 #define         INDF34          INDF3,4
                      00169 #define         INDF33          INDF3,3
                      00170 #define         INDF32          INDF3,2
                      00171 #define         INDF31          INDF3,1
                      00172 #define         INDF30          INDF3,0
                      00173 
                      00174 ;INTE
                      00175 #define         T3IE    INTE,7
                      00176 #define         ADIE    INTE,6
                      00177 #define         T2IE    INTE,5
                      00178 #define         KBIE    INTE,4
                      00179 #define         INT1IE  INTE,3
                      00180 #define         INT0IE  INTE,2
                      00181 #define         T1IE    INTE,1
                      00182 #define         T0IE    INTE,0
                      00183 
                      00184 ;INTF
                      00185 #define         T3IF    INTFLAG,7
                      00186 #define         ADIF    INTFLAG,6 
                      00187 #define         T2IF    INTFLAG,5
                      00188 #define         KBIF    INTFLAG,4
                      00189 #define         INT1IF  INTFLAG,3
                      00190 #define         INT0IF  INTFLAG,2
                      00191 #define         T1IF    INTFLAG,1
                      00192 #define         T0IF    INTFLAG,0
                      00193 
                      00194 ;DRVCR
                      00195 #define         DRVS    DRVCR,7
                      00196 #define         LDRVS   DRVCR,6 
                      00197 #define         PDRVS   DRVCR,5
                      00198 #define         PDRVS0  DRVCR,4
                      00199 #define         PDLYS1  DRVCR,3
                      00200 #define         PDLYS0  DRVCR,2
                      00201 #define         PSPDS1  DRVCR,1
                      00202 #define         PSPDS0  DRVCR,0
                      00203 
                      00204 ;KBCR
                      00205 #define         KBCR6   KBCR,6 
                      00206 #define         KBCR5   KBCR,5
                      00207 #define         KBCR4   KBCR,4
                      00208 #define         KBCR3   KBCR,3
                      00209 #define         KBCR2   KBCR,2
                      00210 #define         KBCR1   KBCR,1
                      00211 #define         KBCR0   KBCR,0
                      00212 
                      00213 ;IOP0
                      00214 #define         P0      IOP0
                      00215 #define         P05D    IOP0,5
                      00216 #define         P04D    IOP0,4
                      00217 #define         P03D    IOP0,3
                      00218 #define         P02D    IOP0,2
                      00219 #define         P01D    IOP0,1
                      00220 #define         P00D    IOP0,0
                      00221 
                      00222 ;OEP0
                      00223 #define         DDR0     OEP0
                      00224 #define         P05OE    OEP0,5
                      00225 #define         P04OE    OEP0,4
                      00226 #define         P03OE    OEP0,3
                      00227 #define         P02OE    OEP0,2
                      00228 #define         P01OE    OEP0,1
                      00229 #define         P00OE    OEP0,0
                      00230 
                      00231 ;PUP0
                      00232 #define         P05PU    PUP0,5
                      00233 #define         P04PU    PUP0,4
                      00234 #define         P03PU    PUP0,3
                      00235 #define         P02PU    PUP0,2
                      00236 #define         P01PU    PUP0,1
                      00237 #define         P00PU    PUP0,0
                      00238 
                      00239 ;PDP0
                      00240 #define         P05PD    PDP0,5
                      00241 #define         P04PD    PDP0,4
                      00242 #define         P03PD    PDP0,3
                      00243 #define         P02PD    PDP0,2
                      00244 #define         P01PD    PDP0,1
                      00245 #define         P00PD    PDP0,0
                      00246 
                      00247 ;IOP1
                      00248 #define         P1      IOP1
                      00249 #define         P17D    IOP1,7
                      00250 #define         P16D    IOP1,6
                      00251 #define         P15D    IOP1,5
                      00252 #define         P14D    IOP1,4
                      00253 #define         P13D    IOP1,3
                      00254 #define         P12D    IOP1,2
                      00255 #define         P11D    IOP1,1
                      00256 #define         P10D    IOP1,0
                      00257 
                      00258 ;OEP1
                      00259 #define         DDR1     OEP1
                      00260 #define         P17OE    OEP1,7
                      00261 #define         P16OE    OEP1,6
                      00262 #define         P15OE    OEP1,5
                      00263 #define         P14OE    OEP1,4
                      00264 #define         P13OE    OEP1,3
                      00265 #define         P12OE    OEP1,2
                      00266 #define         P11OE    OEP1,1
                      00267 #define         P10OE    OEP1,0
                      00268 
                      00269 ;PUP1
                      00270 #define         P17PU    PUP1,7
                      00271 #define         P16PU    PUP1,6
                      00272 #define         P15PU    PUP1,5
                      00273 #define         P14PU    PUP1,4
                      00274 #define         P13PU    PUP1,3
                      00275 #define         P12PU    PUP1,2
                      00276 #define         P11PU    PUP1,1
                      00277 #define         P10PU    PUP1,0
                      00278 
                      00279 ;PDP1
                      00280 #define         P17PD    PDP1,7
                      00281 #define         P16PD    PDP1,6
                      00282 #define         P15PD    PDP1,5
                      00283 #define         P14PD    PDP1,4
                      00284 #define         P13PD    PDP1,3
                      00285 #define         P12PD    PDP1,2
                      00286 #define         P11PD    PDP1,1
                      00287 #define         P10PD    PDP1,0
                      00288 
                      00289 ;T0CR
                      00290 #define         TC0EN           T0CR,7
                      00291 #define         PWM0OE          T0CR,6
                      00292 #define         BUZ0OE          T0CR,5
                      00293 #define         T0PS1           T0CR,4
                      00294 #define         T0PS0           T0CR,3
                      00295 #define         T0PR2           T0CR,2
                      00296 #define         T0PR1           T0CR,1
                      00297 #define         T0PR0           T0CR,0
                      00298 
                      00299 ;T0CNT
                      00300 #define         T0C7    T0CNT,7
                      00301 #define         T0C6    T0CNT,6
                      00302 #define         T0C5    T0CNT,5
                      00303 #define         T0C4    T0CNT,4
                      00304 #define         T0C3    T0CNT,3
                      00305 #define         T0C2    T0CNT,2
                      00306 #define         T0C1    T0CNT,1
                      00307 #define         T0C0    T0CNT,0
                      00308 
                      00309 ;T0LOAD
                      00310 #define         T0LOAD7    T0LOAD,7
                      00311 #define         T0LOAD6    T0LOAD,6
                      00312 #define         T0LOAD5    T0LOAD,5
                      00313 #define         T0LOAD4    T0LOAD,4
                      00314 #define         T0LOAD3    T0LOAD,3
                      00315 #define         T0LOAD2    T0LOAD,2
                      00316 #define         T0LOAD1    T0LOAD,1
                      00317 #define         T0LOAD0    T0LOAD,0
                      00318 
                      00319 ;T0DATA
                      00320 #define         T0DATA7    T0DATA,7
                      00321 #define         T0DATA6    T0DATA,6
                      00322 #define         T0DATA5    T0DATA,5
                      00323 #define         T0DATA4    T0DATA,4
                      00324 #define         T0DATA3    T0DATA,3
                      00325 #define         T0DATA2    T0DATA,2
                      00326 #define         T0DATA1    T0DATA,1
                      00327 #define         T0DATA0    T0DATA,0
                      00328 
                      00329 ;T1CR
                      00330 #define         TC1EN           T1CR,7
                      00331 #define         PWM1OE          T1CR,6
                      00332 #define         BUZ1OE          T1CR,5
                      00333 #define         T1PS1           T1CR,4
                      00334 #define         T1PS0           T1CR,3
                      00335 #define         T1PR2           T1CR,2
                      00336 #define         T1PR1           T1CR,1
                      00337 #define         T1PR0           T1CR,0
                      00338 
                      00339 ;T1CNT
                      00340 #define         T1C7    T1CNT,7
                      00341 #define         T1C6    T1CNT,6
                      00342 #define         T1C5    T1CNT,5
                      00343 #define         T1C4    T1CNT,4
                      00344 #define         T1C3    T1CNT,3
                      00345 #define         T1C2    T1CNT,2
                      00346 #define         T1C1    T1CNT,1
                      00347 #define         T1C0    T1CNT,0
                      00348 
                      00349 ;T1LOAD
                      00350 #define         T1LOAD7    T1LOAD,7
                      00351 #define         T1LOAD6    T1LOAD,6
                      00352 #define         T1LOAD5    T1LOAD,5
                      00353 #define         T1LOAD4    T1LOAD,4
                      00354 #define         T1LOAD3    T1LOAD,3
                      00355 #define         T1LOAD2    T1LOAD,2
                      00356 #define         T1LOAD1    T1LOAD,1
                      00357 #define         T1LOAD0    T1LOAD,0
                      00358 
                      00359 ;T1DATA
                      00360 #define         T1DATA7    T1DATA,7
                      00361 #define         T1DATA6    T1DATA,6
                      00362 #define         T1DATA5    T1DATA,5
                      00363 #define         T1DATA4    T1DATA,4
                      00364 #define         T1DATA3    T1DATA,3
                      00365 #define         T1DATA2    T1DATA,2
                      00366 #define         T1DATA1    T1DATA,1
                      00367 #define         T1DATA0    T1DATA,0
                      00368 
                      00369 ;T2CR
                      00370 #define         TC2EN           T2CR,7
                      00371 #define         PWM2OE          T2CR,6
                      00372 #define         BUZ2OE          T2CR,5
                      00373 #define         T2PS1           T2CR,4
                      00374 #define         T2PS0           T2CR,3
                      00375 #define         T2PR2           T2CR,2
                      00376 #define         T2PR1           T2CR,1
                      00377 #define         T2PR0           T2CR,0
                      00378 
                      00379 ;T2CNT
                      00380 #define         T2C7    T2CNT,7
                      00381 #define         T2C6    T2CNT,6
                      00382 #define         T2C5    T2CNT,5
                      00383 #define         T2C4    T2CNT,4
                      00384 #define         T2C3    T2CNT,3
                      00385 #define         T2C2    T2CNT,2
                      00386 #define         T2C1    T2CNT,1
                      00387 #define         T2C0    T2CNT,0
                      00388 
                      00389 ;T2LOAD
                      00390 #define         T2LOAD7    T2LOAD,7
                      00391 #define         T2LOAD6    T2LOAD,6
                      00392 #define         T2LOAD5    T2LOAD,5
                      00393 #define         T2LOAD4    T2LOAD,4
                      00394 #define         T2LOAD3    T2LOAD,3
                      00395 #define         T2LOAD2    T2LOAD,2
                      00396 #define         T2LOAD1    T2LOAD,1
                      00397 #define         T2LOAD0    T2LOAD,0
                      00398 
                      00399 ;T2DATA
                      00400 #define         T2DATA7    T2DATA,7
                      00401 #define         T2DATA6    T2DATA,6
                      00402 #define         T2DATA5    T2DATA,5
                      00403 #define         T2DATA4    T2DATA,4
                      00404 #define         T2DATA3    T2DATA,3
                      00405 #define         T2DATA2    T2DATA,2
                      00406 #define         T2DATA1    T2DATA,1
                      00407 #define         T2DATA0    T2DATA,0
                      00408 
                      00409 ;T3CR
                      00410 #define         TC3EN           T3CR,7
                      00411 #define         T3PS1           T3CR,4
                      00412 #define         T3PS0           T3CR,3
                      00413 #define         T3PR2           T3CR,2
                      00414 #define         T3PR1           T3CR,1
                      00415 #define         T3PR0           T3CR,0
                      00416 
                      00417 ;T3CNT
                      00418 #define         T3C7    T3CNT,7
                      00419 #define         T3C6    T3CNT,6
                      00420 #define         T3C5    T3CNT,5
                      00421 #define         T3C4    T3CNT,4
                      00422 #define         T3C3    T3CNT,3
                      00423 #define         T3C2    T3CNT,2
                      00424 #define         T3C1    T3CNT,1
                      00425 #define         T3C0    T3CNT,0
                      00426 
                      00427 ;T3LOAD
                      00428 #define         T3LOAD7    T3LOAD,7
                      00429 #define         T3LOAD6    T3LOAD,6
                      00430 #define         T3LOAD5    T3LOAD,5
                      00431 #define         T3LOAD4    T3LOAD,4
                      00432 #define         T3LOAD3    T3LOAD,3
                      00433 #define         T3LOAD2    T3LOAD,2
                      00434 #define         T3LOAD1    T3LOAD,1
                      00435 #define         T3LOAD0    T3LOAD,0
                      00436 
                      00437 ;PWM0DE
                      00438 #define         PWM0DE2    PWM0DE,2
                      00439 #define         PWM0DE1    PWM0DE,1
                      00440 #define         PWM0DE0    PWM0DE,0
                      00441 
                      00442 ;PWM1DE
                      00443 #define         PWM1DE2    PWM1DE,2
                      00444 #define         PWM1DE1    PWM1DE,1
                      00445 #define         PWM1DE0    PWM1DE,0
                      00446 
                      00447 ;PWM2DE
                      00448 #define         PWM2DE2    PWM2DE,2
                      00449 #define         PWM2DE1    PWM2DE,1
                      00450 #define         PWM2DE0    PWM2DE,0
                      00451 
                      00452 ;PWMCR0
                      00453 #define         FPWMEN     PWMCR0,7
                      00454 #define         PWM2INV    PWMCR0,6
                      00455 #define         PWM1INV    PWMCR0,5
                      00456 #define         PWM0INV    PWMCR0,4
                      00457 #define         FPWMR1     PWMCR0,3
                      00458 #define         FPWMR0     PWMCR0,2
                      00459 #define         FPWMF1     PWMCR0,1
                      00460 #define         FPWMF0     PWMCR0,0
                      00461 
                      00462 ;PWMCR1
                      00463 #define         TMRCKS1    PWMCR1,4
                      00464 #define         TMRCKS0    PWMCR1,3
                      00465 #define         PMODE2     PWMCR1,2
                      00466 #define         PMODE1     PWMCR1,1
                      00467 #define         PMODE0     PWMCR1,0
                      00468 
                      00469 ;OSCM
                      00470 #define         STBL    OSCM,5
                      00471 #define         STBH    OSCM,4
                      00472 #define         CLKS    OSCM,2
                      00473 #define         LFEN    OSCM,1
                      00474 #define         HFEN    OSCM,0          
                      00475 
                      00476 ;LVDCR
                      00477 #define         LVDEN    LVDCR,7
                      00478 #define         LVDS3    LVDCR,6
                      00479 #define         LVDS2    LVDCR,5
                      00480 #define         LVDS1    LVDCR,4
                      00481 #define         LVDS0    LVDCR,3
                      00482 #define         LVDF     LVDCR,0
                      00483 
                      00484 ;ADCR0
                      00485 #define         ADCHS3    ADCR0,7
                      00486 #define         ADCHS2    ADCR0,6
                      00487 #define         ADCHS1    ADCR0,5
                      00488 #define         ADCHS0    ADCR0,4
                      00489 #define         ADLEN     ADCR0,3
                      00490 #define         ADEOC     ADCR0,1
                      00491 #define         ADON      ADCR0,0
                      00492 
                      00493 ;ADCR1
                      00494 #define         ADCKS2    ADCR1,7
                      00495 #define         ADCKS1    ADCR1,6
                      00496 #define         ADCKS0    ADCR1,5
                      00497 #define         ADTST     ADCR1,4
                      00498 #define         RESS0     ADCR1,3
                      00499 #define         VRS2      ADCR1,2
                      00500 #define         VRS1      ADCR1,1
                      00501 #define         VRS0      ADCR1,0
                      00502 
                      00503 ;ADCR2
                      00504 #define         ADSMP3    ADCR2,3
                      00505 #define         ADSMP2    ADCR2,2
                      00506 #define         ADSMP1    ADCR2,1
                      00507 #define         ADSMP0    ADCR2,0
                      00508 
                      00509 ;ADRH
                      00510 #define         ADR11     ADRH,7
                      00511 #define         ADR10     ADRH,6
                      00512 #define         ADR9      ADRH,5
                      00513 #define         ADR8      ADRH,4
                      00514 #define         ADR7      ADRH,3
                      00515 #define         ADR6      ADRH,2
                      00516 #define         ADR5      ADRH,1
                      00517 #define         ADR4      ADRH,0
                      00518 
                      00519 ;ADRL
                      00520 #define         ADR3      ADRL,3
                      00521 #define         ADR2      ADRL,2
                      00522 #define         ADR1      ADRL,1
                      00523 #define         ADR0      ADRL,0
                      00524 
                      00525 ;ANSEL0
                      00526 #define         P12ANS    ANSEL0,7
                      00527 #define         P11ANS    ANSEL0,6
                      00528 #define         P05ANS    ANSEL0,5
                      00529 #define         P04ANS    ANSEL0,4
                      00530 #define         P03ANS    ANSEL0,3
                      00531 #define         P02ANS    ANSEL0,2
                      00532 #define         P01ANS    ANSEL0,1
                      00533 #define         P00ANS    ANSEL0,0
                      00534 
                      00535 ;ANSEL1
                      00536 #define         P15ANS    ANSEL1,1
                      00537 #define         P14ANS    ANSEL1,0
                      00538 
                      00539 ;VBGCAL
                      00540 #define         VBGCAL7    VBGCAL,7
                      00541 #define         VBGCAL6    VBGCAL,6
                      00542 #define         VBGCAL5    VBGCAL,5
                      00543 #define         VBGCAL4    VBGCAL,4
                      00544 #define         VBGCAL3    VBGCAL,3
                      00545 #define         VBGCAL2    VBGCAL,2
                      00546 #define         VBGCAL1    VBGCAL,1
                      00547 #define         VBGCAL0    VBGCAL,0
                      00548 
                      00549 ;OSCCAL0
                      00550 #define         OSCCAL7    OSCCAL0,7
                      00551 #define         OSCCAL6    OSCCAL0,6
                      00552 #define         OSCCAL5    OSCCAL0,5
                      00553 #define         OSCCAL4    OSCCAL0,4
                      00554 #define         OSCCAL3    OSCCAL0,3
                      00555 #define         OSCCAL2    OSCCAL0,2
                      00556 #define         OSCCAL1    OSCCAL0,1
                      00557 #define         OSCCAL0    OSCCAL0,0
                      00558 
                      00559 ;OSCCAL1
                      00560 #define         OSCCAL10   OSCCAL1,2
                      00561 #define         OSCCAL9    OSCCAL1,1
                      00562 #define         OSCCAL8    OSCCAL1,0
                      00005 
                      00006 ;==============IO口定义===============
                      00007 ;#define    VREF           P0,4    ;参考电压2.5V(外参)
                      00008 #define    DET_CURRENT     P1,0    ;电流检测
                      00009 #define    LIGHT_LED       P1,4    ;照明灯
                      00010 #define    BOOST_EN        P0,0    ;升压使能
                      00011 
                      00012 #define    KEY_I           P1,1    ;按键
                      00013 #define    LED12           P0,2    ;电量指示
                      00014 #define    LED34           P0,3
                      00015 #define    LED56           P0,4
                      00016 #define    LED78           P0,5
                      00017 #define    CHRG            P1,2    ;检测POWER5v;给移动电源充电5V检测
                      00018 
                      00019 #define    PMOS            P1,7    ;充电PWM1控制
                      00020 #define    NMOS            P1,6    ;升压PWM0控制
                      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           0xc9 ;AD通道选择;1/4VOUT1
                      00029 #define   BOOST5V_ADCH       0xb9  ;1/4VOUT0
                      00030 #define   CURRENT_ADCH       0x59  ;AN5
                      00031 
                      00032 ;参考电压内部2V ,采样12Bit ,1/4 outv ,1/4vdd ,十进制
                      00033 #define         LOW_VBAT_AD         1536 ; 电池低于3v
                      00034 #define         VBAT_AD0            1638 ; 3.2v 低压报警1/4VOUT0 
                      00035 #define         VBAT_AD1            1792 ; 3.5v led1  
                      00036 #define         VBAT_AD2            1920 ; 3.75v led2  
                      00037 #define         VBAT_AD3            1997 ; 3.9v < led3 > led4
                      00038 
                      00039 ;====充电参数=======
                      00040 #define         CHARGE_PWM_DUTY_MAX             98 ;充电最大占空比
                      00041 #define         CHARGE_PWM_DUTY_MIN             10 ;充电最小占空比
                      00042 ;============恒定充电电流为1A，则涓流充电电流为100mA===========
                      00043 #define         SHUT_OFF_CURRENT_AD             10 ; 充电电流关断值 100mA*0.05R（认为电池充满）
                      00044 
                      00045 #define         CONST_CURRENT_AD                102 ;1A  ，   205 :恒流充电值 2A
                      00046 
                      00047 #define         CONST_VOLTAGE_AD                2176;(参考2V) 1450 ; 恒压充电值 4.25V
                      00048 #define         FULL_VOLTAGE_AD                 2190;充满电压值 4.25V
                      00049 ;========================
                      00050 #define         CHARGE_FULL_CNT                 100 ;充满计数
                      00051 
                      00052 ;=====升压参数=======
                      00053 #define         BOOST_PWM_DUTY_MIN              2  ;P16 P17反向输出 最小占空比不能为0 最大也不能到T0LOAD的值
                      00054 #define         BOOST_PWM_DUTY_MAX              25 ;50
                      00055 
                      00056 #define         BOOST_5V_CONST_AD               2560  ;5V    (内部参考2V)
                      00057 
                      00058 ;无负载计数值
                      00059 #define         NO_LOAD_CNT                     5 ;判断负载拔掉次数
                      00060 #define         LOAD_CNT                                                                5
                      00061 
                      00062 ;检测负载电流时的AD值范围
                      00063 #define         LOAD_CURRENT_AD_MIN             10   ; 100mA*0.05R
                      00064 #define         LOAD_CURRENT_AD_MAX            235  ;限流值 2.3A*0.05R
                      00065 #define         SHORT_CIRCUIT_AD               434  ;短路保护电流值（估算）
                      00066 
                      00067 ;==============变量定义 RAM ===============
                      00068         cblock  0x0
                      00069  accTemp  ;中断保存暂存器
                      00070  statusTemp
                      00071 
                      00072  DelayCnt ;延时计数
                      00073  DelayCnt1
                      00074 
                      00075  keyCode         ;键值
                      00076  keyFilterTime   ;按键去抖时间
                      00077  keyPressTime    ;按键时间 
                      00078 
                      00079  time_1ms  ;计时
                      00080  time_10ms
                      00081  time_100ms
                      00082  time_500ms
                      00083  sleepTime
                      00084 
                      00085  Flag                ;标志位寄存器
                      00086  Flag1
                      00087  Flag2
                      00088 
                      00089  ledFlags   ;LED灯标志位 用低4位
                      00090  ledScanCnt ; LED扫描计数
                      00091 
                      00092  displayMode ;电池显示模式
                      00093 
                      00094  cycleCnt ;循环计数
                      00095  cycleCnt1;
                      00096 
                      00097  sumAD        :2 ;多次AD值的和
                      00098  adValue      :2 ;单次采样值
                      00099  vbatAD       :2 ;电池电压值
                      00100  currentAD    :2 ;电流检测值
                      00101  lastAD       :2 ;上一次值
                      00102  boostAD5V    :2 ;升压5V值
                      00103  adAvg        :2
                      00104 
                      00105  adChTemp     ;AD通道
                      00106  ;shortCircuitAD; :2
                      00107  
                      00108  loadCnt 
                      00109  noLoadCnt
                      00110  chargeFullCnt ; 充满计数
                      00111  dutyChargeCnt
                      00112  dutyBoostCnt
                      00113  filterCnt
                      00114  marqueeLEDFlags ;跑马灯数量 值为0x1 x03 0x7 0xf
                      00115  loopCnt
                      00116         endc
                      00117 ;==========寄存器标志位=======================
                      00118 #define         F_keyRelease     Flag,0  ;按键释放
                      00119 #define         F_keyValid       Flag,1  ;按键有效
                      00120 #define         F_load           Flag,2  ;负载标志 1 active(有效)
                      00121 #define         F_power5V        Flag,3  ;检测5V接入
                      00122 #define         F_sleep          Flag,4  ;睡眠标志
                      00123 #define         F_ledOff         Flag,5  ;LED指示灯灭
                      00124 #define         F_showVBAT       Flag,6  ;电量显示
                      00125 #define         F_blink          Flag,7  ;闪烁标志
                      00126 
                      00127 #define         F_time10ms       Flag1,0 ;10ms标志 
                      00128 #define         F_time100ms      Flag1,1 ;100ms标志
                      00129 #define         F_chargeFull     Flag1,2 ;充满标志   
                      00130 #define         F_preCharge      Flag1,3 ;预充电
                      00131 #define         F_time500ms      Flag1,4 ;500ms标志
                      00132 #define         F_detLoad        Flag1,5 ;开始检测负载
                      00133 #define         F_lightSwitch    Flag1,6 ;照明灯开关
                      00134 #define         F_displayEn      Flag1,7 ;显示使能
                      00135 
                      00136 #define         F_noLoadState     Flag2,0 ;空载状态
                      00137 #define         F_marquee500ms    Flag2,1 ;跑马灯间隔时间
                      00138 
                      00139 ;=============程序开始======================
                      00140 
                      00141                 ORG             0x00
0000   DF88           00142                 bclr            GIE     ;关中断
0001   A000           00143                 goto            START
                      00144 
                      00145 ;=============中断向量====================
                      00146                ORG              0x08
0008                  00147 InterruptVector:
0008   5600           00148                movra       accTemp   ;中断之前保存ACC里面的值
0009   4587           00149                swapar      STATUS    ;中断之前保存状态寄存器
000A   5601           00150                movra       statusTemp
                      00151 
000B                  00152 TIM0_IRQ:
                      00153           ;jbclr      T0IE     ;是否开启了定时器0  开启1 关闭0
000B   E18B           00154           jbset       T0IF     ;定时器0是否产生了中断 1产生 0无
000C   A000           00155           goto        TIM1_IRQ
000D   D18B           00156           bclr        T0IF
                      00157 
000E                  00158 TIM1_IRQ:
                      00159           ;jbclr      T1IE   ;是否开启了定时器1  开启1 关闭0
000E   E38B           00160           jbset       T1IF   ;定时器1是否产生了中断 1产生 0无
000F   A000           00161           goto        TIM2_IRQ
0010   D38B           00162           bclr        T1IF
                      00163           
                      00164 
0011                  00165 TIM2_IRQ:
                      00166           ;jbclr      T2IE   ;是否开启了定时器2  开启1 关闭0
0011   EB8B           00167           jbset       T2IF   ;定时器2是否产生了中断 1产生 0无
0012   A000           00168           goto        TIM3_IRQ
0013   DB8B           00169           bclr        T2IF          
                      00170 
0014                  00171 TIM3_IRQ:
                      00172           ;jbclr      T3IE   ;是否开启了定时器2  开启1 关闭0
0014   EF8B           00173           jbset       T3IF   ;定时器2是否产生了中断 1产生 0无
0015   A000           00174           goto        INT0_IRQ
0016   DF8B           00175           bclr        T3IF
0017   6607           00176           incr        time_1ms
0018   EE0D           00177           jbset       F_displayEn
0019   A000           00178           goto        TimeAccumulation ;时间累加
001A   8000           00179           call        _DisplayLED
001B                  00180 TimeAccumulation:
001B   3C0A           00181           movai       10
001C   4007           00182           xorar       time_1ms
001D   E587           00183           jbset       Z
001E   A000           00184           goto        INT0_IRQ
001F   7607           00185           clrr        time_1ms
0020   6608           00186           incr        time_10ms
0021   C00D           00187           bset        F_time10ms
                      00188                                 
0022                  00189 INT0_IRQ: ;外部中断0
                      00190           ;jbclr      INT0IE ; 1开启了外部中断0 0关闭
0022   E58B           00191           jbset       INT0IF
0023   A000           00192           goto        INT1_IRQ
0024   D58B           00193           bclr        INT0IF
                      00194 
0025                  00195 INT1_IRQ: ;外部中断1
                      00196             ;jbclr      INT1IE ; 1开启了外部中断 0关闭
0025   E78B           00197             jbset       INT1IF
0026   A000           00198             goto        KBIM_IRQ
0027   D78B           00199             bclr        INT1IF
                      00200 
0028                  00201 KBIM_IRQ: ;键盘中断
                      00202             ;jbclr      KBIE
0028   E98B           00203             jbset       KBIF
0029   A000           00204             goto        ExitInterrupt
002A   D98B           00205             bclr        KBIF
                      00206                                 
                      00207 
002B                  00208 ExitInterrupt:;中断恢复
002B   4401           00209                 swapar      statusTemp
002C   5787           00210                 movra       STATUS                
002D   5800           00211                 movar       accTemp
002E   000D           00212                 retie
                      00213 ;=========end interrupt===========
                      00214 
                      00215 ;==========初始化寄存器===========
002F                  00216 _InitRst:
                      00217 
002F   3C00           00218         movai       0x00
0030   5790           00219         movra       IOP0
0031   3C00           00220         movai       0x00
0032   5794           00221         movra       IOP1
                      00222         
0033   3C00           00223         movai       0x00
0034   5792           00224         movra       PUP0
0035   3C00           00225         movai       0x00
0036   5793           00226         movra       PDP0
0037   3C00           00227         movai       0x00
0038   5797           00228         movra       PDP1
0039   3C02           00229         movai       0x02
003A   5796           00230         movra       PUP1   ;P11输入上拉
                      00231         
003B   3CFD           00232         movai       0xfd
003C   5791           00233         movra       OEP0    
003D   3CF0           00234         movai       0xf0
003E   5795           00235         movra       OEP1    ; P01 P10 P11 P12 P13做输入
                      00236         
003F   3C20           00237         movai       0x20
0040   57B6           00238         movra       ANSEL0   ;P10设为模拟信号输入口               
                      00239         
0041   3C08           00240         movai       0x08     ;时钟源为FHOSC 1分频
0042   5798           00241         movra       T0CR
0043   3C3F           00242         movai       63
0044   579A           00243         movra       T0LOAD  ;升压PWM频率(1/27)*1*(63+1) 421K 实际23M
0045   3C00           00244         movai       0
0046   579B           00245         movra       T0DATA
                      00246         
0047   3C00           00247         movai       0x00    ;时钟源为FCPU 1分频 仿真只有16M 实际芯片23M
0048   579C           00248         movra       T1CR
0049   3C63           00249         movai       99
004A   579E           00250         movra       T1LOAD  ;PWM充电频率 ((1/23)/4)*1*(99+1) = 57K 充电频率
004B   3C00           00251         movai       0
004C   579F           00252         movra       T1DATA  ;PWM1
                      00253         
004D   3C08           00254         movai       0x08
004E   57A0           00255         movra       T2CR        ;时钟源为FHOSC 1分频 
004F   3C3F           00256         movai       63
0050   57A2           00257         movra       T2LOAD
0051   3C01           00258         movai       1
0052   57A3           00259         movra       T2DATA     ;工作在PWM模式?
                      00260         
0053   3C0D           00261         movai       0x0d
0054   57A4           00262         movra       T3CR        ;32/8 = 4M  时钟为FHOSC，32分频
0055   3C7D           00263         movai       125        ;T3定时1ms中断
0056   57A6           00264         movra       T3LOAD
                      00265         
0057   3C00           00266         movai       0x00
0058   5788           00267         movra       MCR         ;外部中断1 上升沿中断
0059   3C00           00268         movai       0x00
005A   57AC           00269         movra       PWMCR0
                      00270         
005B   3C51           00271         movai       0x51
005C   57B1           00272         movra       ADCR1      ;AD时钟频率FHIRC/8=4MHz  ,内部参考3V                
                      00273         ;movai       0x09
                      00274         ;movra       ADCR0     ;测内参3V时要开AD
005D   CFA0           00275         bset       TC2EN
005E   CB8A           00276         bset       T2IE
005F   C38E           00277         bset       KBCR,1      ;使能P11口的键盘中断
0060   C98A           00278         bset       KBIE        ;使能键盘中断       
0061   C78A           00279         bset       INT1IE      ;使能外部中断1   （5v电源输入）
                      00280         
0062   CF98           00281         bset       TC0EN
0063   CD98           00282         bset       PWM0OE        
                      00283         ;bset      PWMCR0,7    ;允许PWM1 翻转输出到PWM0 故PWM0无需设置
                      00284         ;bset      PWMCR0,5    ;PWM0与FPWM1 取反
                      00285         ;bset      PWMCR0,4
                      00286         ;movai     0xb5
                      00287         ;movra     PWMCR0
0064   CF9C           00288         bset       TC1EN
0065   CD9C           00289         bset       PWM1OE    ;PWM1
0066   000C           00290         return
                      00291 ;==========end 初始化========
                      00292 
                      00293 ;=========初始化 RAM=========
0067                  00294 _InitRAM:
0067   7784           00295            clrr        FSR0   
0068                  00296 InitRAM0:
0068   7780           00297            clrr        INDF0                       
0069   6784           00298            incr        FSR0
006A   3C7F           00299            movai       0x7F
006B   4984           00300            rsubar      FSR0
006C   E587           00301            jbset       Z
006D   A000           00302            goto        InitRAM0
006E   000C           00303            return
                      00304 ;======END RAM===============
                      00305 
                      00306 ;======延时函数==============
006F                  00307 _Delay:
006F   3CFF           00308          movai       0xff 
0070   5602           00309          movra       DelayCnt
                      00310 
0071                  00311 Delay_1:
0071   3CFF           00312          movai       0xFF
0072   5603           00313          movra       DelayCnt1
0073                  00314 Delay_2:
0073   6A03           00315          djzr        DelayCnt1
0074   A000           00316          goto        Delay_2
0075   6A02           00317          djzr        DelayCnt
0076   A000           00318          goto        Delay_1
0077   000C           00319          return
                      00320 ;=====END 延时函数===========
                      00321 
                      00322 ;=============按键扫描=======
0078                  00323 _KeyScan: 
0078   F394           00324       jbclr       KEY_I           ;P11口
0079   A000           00325       goto        NoKeyPress
007A   3C64           00326       movai       KEY_EFFECT     ;按键抖动计数100
007B   4805           00327       rsubar      keyFilterTime  ;按键去抖时间
007C   F187           00328       jbclr       C              ;相减结果产生借位，则0→C；否则1→C
007D   000C           00329       return
007E   6605           00330       incr        keyFilterTime
007F   3C64           00331       movai       KEY_EFFECT
0080   4005           00332       xorar       keyFilterTime
0081   E587           00333       jbset       Z
0082   000C           00334       return  
0083   F00C           00335       jbclr       F_keyRelease    ;按键释放
0084   000C           00336       return 
0085   C20C           00337       bset        F_keyValid     ;按键有效
0086   C00C           00338       bset        F_keyRelease
0087   7606           00339       clrr        keyPressTime
0088   000C           00340       return 
0089                  00341 NoKeyPress:
0089   5A05           00342          movr        keyFilterTime ;判断是否为0
008A   F587           00343          jbclr       Z          ;R为0，则1→Z；否则0→Z
008B   000C           00344          return 
008C   3C05           00345          movai       5
008D   4805           00346          rsubar      keyFilterTime
008E   E187           00347          jbset       C         ;相减结果产生借位，则0→C；否则1→C
008F   A000           00348          goto        ExitKeyScan
0090   6E05           00349          decr        keyFilterTime
0091   000C           00350          return 
0092                  00351 ExitKeyScan:
0092   7605           00352          clrr        keyFilterTime
0093   D00C           00353          bclr        F_keyRelease
0094   000C           00354          return
                      00355 
0095                  00356 _KeyDeal:
0095   E20C           00357           jbset       F_keyValid
0096   A000           00358           goto        ExitKeyDeal
0097   3C0F           00359           movai       15
0098   4806           00360           rsubar      keyPressTime ;判断是否为长按键
0099   E187           00361           jbset       C            ;相减结果产生借位，则0→C；否则1→C
009A   A000           00362           goto        JudgeShortKey ;判断是否是短按键   
009B   D20C           00363           bclr        F_keyValid
009C   3C02           00364           movai       LONG_KEY
009D   5604           00365           movra       keyCode
009E   000C           00366           return  
009F                  00367 JudgeShortKey:                ;判断是否为短按键
009F   F00C           00368             jbclr       F_keyRelease  ;判断按键是否释放
00A0   000C           00369             return
00A1   D20C           00370             bclr        F_keyValid
00A2   3C01           00371             movai       SHORT_KEY
00A3   5604           00372             movra       keyCode
00A4   000C           00373             return      
00A5                  00374 ExitKeyDeal:;无按键
00A5   3C00           00375             movai       NO_KEY
00A6   5604           00376             movra       keyCode
00A7   000C           00377             return
                      00378 ;=============END 按键扫描=============
                      00379 
                      00380 ;=============时基=====================
00A8                  00381 _TimeBase:         
00A8   3C0A           00382         movai       10
00A9   4008           00383         xorar       time_10ms
00AA   E587           00384         jbset       Z
00AB   000C           00385         return
00AC   7608           00386         clrr        time_10ms                                
00AD   6606           00387         incr        keyPressTime                                
00AE   C20D           00388         bset        F_time100ms ;100MS标志                               
00AF   6609           00389         incr        time_100ms
00B0   3C05           00390         movai       5
00B1   4009           00391         xorar       time_100ms
00B2   E587           00392         jbset       Z
00B3   000C           00393         return                                
00B4   7609           00394         clrr        time_100ms ;500ms                                
00B5   3C80           00395         movai        0x80
00B6   420C           00396         xorra        Flag      ;异或,将bit7取反                                
00B7   C80D           00397         bset         F_time500ms
00B8   C20E           00398         bset         F_marquee500ms                                
00B9   F60C           00399         jbclr        F_power5V   
00BA   000C           00400         return
00BB   F40C           00401         jbclr        F_load      ;负载标志
00BC   000C           00402         return
00BD   FC0D           00403         jbclr        F_lightSwitch;照明灯开关
00BE   000C           00404         return
00BF   660B           00405         incr         sleepTime
00C0   3C14           00406         movai        20
00C1   400B           00407         xorar        sleepTime
00C2   E587           00408         jbset        Z
00C3   000C           00409         return
00C4   760B           00410         clrr         sleepTime
00C5   C80C           00411         bset         F_sleep
00C6   000C           00412         return
                      00413 ;=============END  TIME=============
                      00414 
00C7                  00415 _BatteryMode:
00C7   3C66           00416            movai       low(VBAT_AD0)  ;1747(十进制) ; 3.2v 低压报警
00C8   4818           00417            rsubar      vbatAD
00C9   3C06           00418            movai       high(VBAT_AD0)   
00CA   0C19           00419            rsbcar      vbatAD+1    
00CB   F187           00420            jbclr       C          ;相减结果产生借位，则0→C（低于3.2V）；否则1→C(高于3.2V)
00CC   A000           00421            goto        Battery_MODE_1  
00CD   3C01           00422            movai       1
00CE   A000           00423            goto        Exit_Battery_MODE
00CF                  00424 Battery_MODE_1:
00CF   3C00           00425                movai       low(VBAT_AD1)
00D0   4818           00426                rsubar      vbatAD
00D1   3C07           00427                movai       high(VBAT_AD1)
00D2   0C19           00428                rsbcar      vbatAD+1
00D3   F187           00429                jbclr       C             ;相减结果产生借位，则0→C（低于3.5V）；否则1→C(高于3.5V)
00D4   A000           00430                goto        Battery_MODE_2  
00D5   3C02           00431                movai       2
00D6   A000           00432                goto        Exit_Battery_MODE
00D7                  00433 Battery_MODE_2:
00D7   3C80           00434                movai       low(VBAT_AD2)
00D8   4818           00435                rsubar      vbatAD
00D9   3C07           00436                movai       high(VBAT_AD2)
00DA   0C19           00437                rsbcar      vbatAD+1
00DB   F187           00438                jbclr       C               ;相减结果产生借位，则0→C（低于3.75V）；否则1→C(高于3.75V)
00DC   A000           00439                goto        Battery_MODE_3
00DD   3C03           00440                movai       3
00DE   A000           00441                goto        Exit_Battery_MODE
00DF                  00442 Battery_MODE_3:
00DF   3CCD           00443                 movai       low(VBAT_AD3)
00E0   4818           00444                 rsubar      vbatAD
00E1   3C07           00445                 movai       high(VBAT_AD3)
00E2   0C19           00446                 rsbcar      vbatAD+1
00E3   F187           00447                 jbclr       C              ;相减结果产生借位，则0→C（低于3.9V）；否则1→C(高于3.9V)
00E4   A000           00448                 goto        Battery_MODE_4
00E5   3C04           00449                 movai       4
00E6   A000           00450                 goto        Exit_Battery_MODE
00E7                  00451 Battery_MODE_4:
00E7   3C05           00452                 movai       5
00E8                  00453 Exit_Battery_MODE:
00E8   5611           00454                 movra       displayMode
00E9   000C           00455                 return
                      00456 
00EA                  00457 _BrightLED1:
00EA   C590           00458             bset                            LED12
00EB   D790           00459             bclr                            LED34
00EC   D990           00460             bclr                            LED56
00ED   DB90           00461             bclr                            LED78            
00EE   000C           00462             return
                      00463 
00EF                  00464 _BrightLED2:
00EF   C590           00465             bset                            LED12
00F0   C790           00466             bset                            LED34
00F1   D990           00467             bclr                            LED56
00F2   DB90           00468             bclr                            LED78            
00F3   000C           00469             return
                      00470 
00F4                  00471 _BrightLED3:
00F4   C590           00472             bset                            LED12
00F5   C790           00473             bset                            LED34
00F6   C990           00474             bset                            LED56
00F7   DB90           00475             bclr                            LED78            
00F8   000C           00476             return
                      00477 
00F9                  00478 _BrightLED4:
00F9   C590           00479           bset                            LED12
00FA   C790           00480           bset                            LED34
00FB   C990           00481           bset                            LED56
00FC   CB90           00482           bset                            LED78         
00FD   000C           00483           return
                      00484 
00FE                  00485 _OFF_LED:
00FE   D590           00486           bclr                            LED12
00FF   D790           00487           bclr                            LED34
0100   D990           00488           bclr                            LED56
0101   DB90           00489           bclr                            LED78          
0102   000C           00490           return
                      00491 
0103                  00492 _DisplayLED:
0103   5A10           00493        movr                            ledScanCnt ;LED1   将寄存器R内容存到R，会影响Z标志位
0104   E587           00494        jbset                           Z          ;R为0，则1→Z；否则0→Z
0105   A000           00495        goto                            DisplayLED2
0106   3C01           00496        movai                           0x1
0107   780F           00497        andar                           ledFlags   ;与的结果为0，则1→Z；否则0→Z
0108   F587           00498        jbclr                           Z
0109   A000           00499        goto                            LED_OFF
010A   8000           00500        call                            _BrightLED1
010B   A000           00501        goto                            LEDScan
                      00502 
010C                  00503 DisplayLED2:
010C   3C01           00504       movai                           1
010D   4010           00505       xorar                           ledScanCnt ;LED2
010E   E587           00506       jbset                           Z
010F   A000           00507       goto                            DisplayLED3
0110   3C02           00508       movai                           0x2
0111   780F           00509       andar                           ledFlags
0112   F587           00510       jbclr                           Z
0113   A000           00511       goto                            LED_OFF
0114   8000           00512       call                            _BrightLED2
0115   A000           00513       goto                            LEDScan
                      00514 
0116                  00515 DisplayLED3:
0116   3C02           00516      movai                           2
0117   4010           00517      xorar                           ledScanCnt ;LED3
0118   E587           00518      jbset                           Z
0119   A000           00519      goto                            DisplayLED4
011A   3C04           00520      movai                           0x4
011B   780F           00521      andar                           ledFlags
011C   F587           00522      jbclr                           Z
011D   A000           00523      goto                            LED_OFF
011E   8000           00524      call                            _BrightLED3
011F   A000           00525      goto                            LEDScan
                      00526 
0120                  00527 DisplayLED4:
0120   3C03           00528          movai                           3
0121   4010           00529          xorar                           ledScanCnt ;LED4
0122   E587           00530          jbset                           Z
0123   000C           00531          return
0124   3C08           00532          movai                           0x8
0125   780F           00533          andar                           ledFlags
0126   F587           00534          jbclr                           Z
0127   A000           00535          goto                            LED_OFF
0128   8000           00536          call                            _BrightLED4
0129   A000           00537          goto                            LEDScan
                      00538 
012A                  00539 LED_OFF:
012A   8000           00540          call                            _OFF_LED
012B                  00541 LEDScan:
012B   6610           00542          incr                            ledScanCnt
012C   3C04           00543          movai                           4
012D   4010           00544          xorar                           ledScanCnt
012E   E587           00545          jbset                           Z
012F   000C           00546          return
0130   7610           00547          clrr                            ledScanCnt
0131   000C           00548          return
                      00549 
0132                  00550 _MarqueeLED:
0132   E20E           00551       jbset                           F_marquee500ms ;跑马灯 500ms一次
0133   000C           00552       return
0134   D20E           00553       bclr                            F_marquee500ms
0135   D187           00554       bclr                            C
0136   520F           00555       rlr                             ledFlags  ;寄存器R循环左移（带C标志），结果存到R
0137   660F           00556       incr                            ledFlags
0138   3C1F           00557       movai                           0x1f
0139   480F           00558       rsubar                          ledFlags
013A   E187           00559       jbset                           C      ;相减结果产生借位，则0→C；否则1→C
013B   000C           00560       return          
013C   5829           00561       movar                           marqueeLEDFlags
013D   560F           00562       movra                           ledFlags
013E   000C           00563       return
                      00564                                                                 
013F                  00565 _DisplayPrcess:
013F   E40D           00566          jbset                           F_chargeFull
0140   A000           00567          goto                            DisplayMode_1
0141   3C0F           00568          movai                           0xf
0142   560F           00569          movra                           ledFlags
0143   000C           00570          return
                      00571                                 
0144                  00572 DisplayMode_1: 
0144   3C01           00573         movai                           1 ;显示模式1
0145   4011           00574         xorar                           displayMode
0146   E587           00575         jbset                           Z      ;异或的结果为0，则1→Z；否则0→Z
0147   A000           00576         goto                            DisplayMode_2          
0148   E60C           00577         jbset                           F_power5V ;充电模式1
0149   A000           00578         goto                            LoadMode_1 
014A   3C00           00579         movai                           0x0
014B   5629           00580         movra                           marqueeLEDFlags
014C   8000           00581         call                            _MarqueeLED
014D   000C           00582         return
                      00583                                 
014E                  00584 LoadMode_1: ;负载模式1
014E   E40C           00585         jbset                           F_load
014F   A000           00586         goto                            NoLoadMode_1 ;点亮LED1
0150   3C03           00587         movai                           3
0151   4809           00588         rsubar                          time_100ms
0152   F187           00589         jbclr                           C
0153   A000           00590         goto                            BlinkMode_1_OFF ;模式1 闪烁灭
0154   3C01           00591         movai                           0x1
0155   560F           00592         movra                           ledFlags
0156   000C           00593         return
0157                  00594 BlinkMode_1_OFF:        
0157   3C00           00595        movai                           0x0
0158   560F           00596        movra                           ledFlags
0159   000C           00597        return
                      00598 
                      00599                                 
015A                  00600 NoLoadMode_1: ;无负载模式1
015A   3C01           00601         movai                           0x1
015B   560F           00602         movra                           ledFlags
015C   000C           00603         return
                      00604 
015D                  00605 DisplayMode_2:
015D   3C02           00606       movai                           2
015E   4011           00607       xorar                           displayMode
015F   E587           00608       jbset                           Z
0160   A000           00609       goto                            DisplayMode_3 
0161   E60C           00610       jbset                           F_power5V ;充电模式2
0162   A000           00611       goto                            LoadMode_2 
0163   3C00           00612       movai                           0x0
0164   5629           00613       movra                           marqueeLEDFlags
0165   8000           00614       call                            _MarqueeLED
0166   000C           00615       return
                      00616 
0167                  00617 LoadMode_2:
0167   E40C           00618       jbset                           F_load
0168   A000           00619       goto                            NoLoadMode_2
0169   EE0C           00620       jbset                           F_blink
016A   A000           00621       goto                            BlinkMode_2_OFF
016B   3C01           00622       movai                           0x1
016C   560F           00623       movra                           ledFlags
016D   000C           00624       return
                      00625       
016E                  00626 BlinkMode_2_OFF:
016E   3C00           00627          movai                         0x0
016F   560F           00628          movra                         ledFlags
0170   000C           00629          return
                      00630                                 
0171                  00631 NoLoadMode_2:
0171   3C01           00632        movai                           0x1
0172   560F           00633        movra                           ledFlags
0173   000C           00634        return
                      00635                 
0174                  00636 DisplayMode_3:
0174   3C03           00637            movai                           3
0175   4011           00638            xorar                           displayMode
0176   E587           00639            jbset                           Z
0177   A000           00640            goto                            DisplayMode_4 
0178   E60C           00641            jbset                           F_power5V ;充电模式3
0179   A000           00642            goto                            LoadMode_3 
017A   3C01           00643            movai                           0x1
017B   5629           00644            movra                           marqueeLEDFlags
017C   8000           00645            call                            _MarqueeLED
017D   000C           00646            return
                      00647 
017E                  00648 LoadMode_3:
017E   E40C           00649            jbset                           F_load
017F   A000           00650            goto                            NoLoadMode_3
0180   EE0C           00651            jbset                           F_blink
0181   A000           00652            goto                            BlinkMode_3_OFF
0182   3C03           00653            movai                           0x3
0183   560F           00654            movra                           ledFlags
0184   000C           00655            return
0185                  00656 BlinkMode_3_OFF:
0185   3C01           00657             movai                           0x1
0186   560F           00658             movra                           ledFlags
0187   000C           00659             return
                      00660              
0188                  00661 NoLoadMode_3:
0188   3C03           00662             movai                           0x3
0189   560F           00663             movra                           ledFlags
018A   000C           00664             return
                      00665 
018B                  00666 DisplayMode_4:
018B   3C04           00667         movai                           4
018C   4011           00668         xorar                           displayMode
018D   E587           00669         jbset                           Z
018E   A000           00670         goto                            DisplayMode_5
018F   E60C           00671         jbset                           F_power5V ;充电模式3
0190   A000           00672         goto                            LoadMode_4 
0191   3C03           00673         movai                           0x3
0192   5629           00674         movra                           marqueeLEDFlags
0193   8000           00675         call                            _MarqueeLED
0194   000C           00676         return
                      00677 
0195                  00678 LoadMode_4:
0195   E40C           00679            jbset                           F_load
0196   A000           00680            goto                            NoLoadMode_4
0197   EE0C           00681            jbset                           F_blink
0198   A000           00682            goto                            BlinkMode_4_OFF
0199   3C07           00683            movai                           0x7
019A   560F           00684            movra                           ledFlags
019B   000C           00685            return
019C                  00686 BlinkMode_4_OFF:
019C   3C03           00687              movai                           0x3
019D   560F           00688              movra                           ledFlags
019E   000C           00689              return
                      00690              
019F                  00691 NoLoadMode_4:
019F   3C07           00692              movai                           0x7
01A0   560F           00693              movra                           ledFlags
01A1   000C           00694              return
                      00695 
01A2                  00696 DisplayMode_5:
01A2   3C05           00697             movai                           5
01A3   4011           00698             xorar                           displayMode
01A4   E587           00699             jbset                           Z
01A5   000C           00700             return
01A6   E60C           00701             jbset                           F_power5V ;充电模式3
01A7   A000           00702             goto                            LoadMode_5 
01A8   3C07           00703             movai                           0x7
01A9   5629           00704             movra                           marqueeLEDFlags
01AA   8000           00705             call                            _MarqueeLED
01AB   000C           00706             return
                      00707 
01AC                  00708 LoadMode_5:
01AC   E40C           00709             jbset                           F_load
01AD   A000           00710             goto                            NoLoadMode_5
01AE   EE0C           00711             jbset                           F_blink
01AF   A000           00712             goto                            BlinkMode_5_OFF
01B0   3C0F           00713             movai                           0xf
01B1   560F           00714             movra                           ledFlags
01B2   000C           00715             return
01B3                  00716 BlinkMode_5_OFF:
01B3   3C07           00717              movai                           0x7
01B4   560F           00718              movra                           ledFlags
01B5   000C           00719              return
                      00720              
01B6                  00721 NoLoadMode_5:
01B6   3C0F           00722              movai                           0xf
01B7   560F           00723              movra                           ledFlags
01B8   000C           00724              return
                      00725 ;=========end display=============
                      00726 
                      00727 ;===========AD检测=================
01B9                  00728 _ADCSbr:
01B9   57B0           00729      movra       ADCR0   ;0xb9  0x6d
01BA   E3B0           00730      jbset       ADEOC   ;判断AD转换是否完毕
01BB   A000           00731      goto        $-1     ;回到上一条指令     
01BC   D187           00732      bclr        C
01BD   7616           00733      clrr        adValue
01BE   3C04           00734      movai       4
01BF   5612           00735      movra       cycleCnt     
01C0   59B4           00736      movar       ADRH
01C1   5617           00737      movra       adValue+1   ;保存ADValue 高八位
01C2                  00738 GetADValue:
01C2   4E17           00739        rrr         adValue+1  ;寄存器R循环右移（带C标志），结果存到R  
01C3   4E16           00740        rrr         adValue     ;ADValue 低八位
01C4   6A12           00741        djzr        cycleCnt
01C5   A000           00742        goto        GetADValue
01C6   59B5           00743        movar       ADRL
01C7   5E16           00744        orra        adValue    ;寄存器R内容和ACC或操作，结果存到R
01C8   000C           00745        return
                      00746 
01C9                  00747 _MultipleADSampling: ;连续8次AD值
01C9   3C08           00748            movai       8      ;可填128次  保证10位精度
01CA   5613           00749            movra       cycleCnt1
01CB   7614           00750            clrr        sumAD
01CC   7615           00751            clrr        sumAD+1
01CD                  00752 ADSampling:
01CD   5822           00753         movar       adChTemp ;   传递AD通道VOUT 
01CE   8000           00754         call        _ADCSbr
01CF   D187           00755         bclr        C
01D0   5816           00756         movar       adValue
01D1   7E14           00757         addra       sumAD
01D2   5817           00758         movar       adValue+1
01D3   1215           00759         adcra       sumAD+1
01D4   6A13           00760         djzr        cycleCnt1
01D5   A000           00761         goto        ADSampling
01D6                  00762 Get_AD_AVG:  ;8次AD的平均值
01D6   7620           00763           clrr        adAvg
01D7   7621           00764           clrr        adAvg+1
01D8   D187           00765           bclr        C
01D9   3C03           00766           movai       3       ;7:128次的平均值
01DA   5612           00767           movra       cycleCnt
01DB                  00768 Get_AD_AVG_1:
01DB   4E15           00769          rrr         sumAD+1
01DC   4E14           00770          rrr         sumAD
01DD   D187           00771          bclr        C
01DE   6A12           00772          djzr        cycleCnt
01DF   A000           00773          goto        Get_AD_AVG_1
                      00774          
01E0   5814           00775          movar       sumAD
01E1   5620           00776          movra       adAvg
01E2   5815           00777          movar       sumAD+1
01E3   5621           00778          movra       adAvg+1
01E4   000C           00779          return
                      00780 
01E5                  00781 _BatSampleSbr:
01E5   3CC9           00782          movai       BAT_ADCH ; 0x7d  采电池电压(取样)
01E6   5622           00783          movra       adChTemp
01E7   8000           00784          call        _MultipleADSampling
01E8   5820           00785          movar       adAvg
01E9   5618           00786          movra       vbatAD
01EA   5821           00787          movar       adAvg+1
01EB   5619           00788          movra       vbatAD+1
01EC   000C           00789          return
                      00790 
01ED                  00791 _CurrentSampleSbr:
01ED   3C59           00792            movai       CURRENT_ADCH ;电流采样
01EE   5622           00793            movra       adChTemp
01EF   8000           00794            call        _MultipleADSampling
01F0   5820           00795            movar       adAvg
01F1   561A           00796            movra       currentAD
01F2   5821           00797            movar       adAvg+1
01F3   561B           00798            movra       currentAD+1
01F4   000C           00799            return
                      00800 
01F5                  00801 _Boost5VSampleSbr:
01F5   3CB9           00802             movai       BOOST5V_ADCH ;升压5V采样
01F6   5622           00803             movra       adChTemp
01F7   8000           00804             call        _MultipleADSampling
01F8   5820           00805             movar       adAvg
01F9   561E           00806             movra       boostAD5V
01FA   5821           00807             movar       adAvg+1
01FB   561F           00808             movra       boostAD5V+1
01FC   000C           00809             return
                      00810 ;===============END AD==============
01FD                  00811 _Charging: ;充电中
01FD   F40D           00812             jbclr        F_chargeFull ;充满退出 1 充满
01FE   000C           00813             return     
01FF   E00D           00814             jbset        F_time10ms
0200   000C           00815             return
0201   D00D           00816             bclr         F_time10ms            
0202   8000           00817             call         _BatSampleSbr                           
0203   8000           00818             call         _CurrentSampleSbr            
0204   3C04           00819             movai        4
0205   4811           00820             rsubar      displayMode ; 显示模式>= 4后 才能判断充电是否已满
0206   E187           00821             jbset        C
0207   A000           00822              goto         AdjustChargePWM  ;调节充电PWM 
                      00823              ;===检测是否充满
0208   3C0A           00824              movai        low(SHUT_OFF_CURRENT_AD) ;检测充电电流是否小于关断值
0209   481A           00825              rsubar       currentAD
020A   3C00           00826              movai        high(SHUT_OFF_CURRENT_AD)
020B   0C1B           00827              rsbcar       currentAD+1 ; <最小电流关断值
020C   F187           00828              jbclr        C 
020D   A000           00829              goto         DetectionChargeVBAT ; 检测充电电压 
020E                  00830 BatteryFull:                                                                                      
020E   6625           00831              incr         chargeFullCnt
020F   3CFF           00832              movai        255
0210   4025           00833              xorar        chargeFullCnt
0211   E587           00834              jbset        Z
0212   A000           00835              goto         BatteryFullOfCnt        ;充满计数
0213   7625           00836              clrr         chargeFullCnt
0214   6626           00837              incr         chargeFullCnt+1
0215                  00838 BatteryFullOfCnt:
0215   3C64           00839                movai      low(CHARGE_FULL_CNT)
0216   4825           00840                rsubar     chargeFullCnt
0217   3C00           00841                movai      high(CHARGE_FULL_CNT)
0218   0C26           00842                rsbcar     chargeFullCnt+1
0219   E187           00843                jbset      C                       
021A   A000           00844                goto       AdjustChargePWM                         
021B   C40D           00845                bset       F_chargeFull                    ;充电已满
021C   DF9C           00846                bclr       TC1EN                           ;停掉PWM
021D   DD9C           00847                bclr       PWM1OE  
021E   CF94           00848                bset       PMOS
021F   000C           00849                return
                      00850                                 
0220                  00851 DetectionChargeVBAT:                                                            
0220   3C8E           00852                movai       low(FULL_VOLTAGE_AD)
0221   4818           00853                rsubar      vbatAD
0222   3C08           00854                movai       high(FULL_VOLTAGE_AD)
0223   0C19           00855                rsbcar      vbatAD+1
0224   E187           00856                jbset       C 
0225   A000           00857                goto        BatteryNotFull                  
0226   A000           00858                goto        BatteryFull                                     
0227                  00859 BatteryNotFull:                                            
0227   7625           00860                clrr        chargeFullCnt
0228   7626           00861                clrr        chargeFullCnt+1
                      00862 
0229                  00863 AdjustChargePWM:                                                                                                                        
0229   3C00           00864       movai     low(LOW_VBAT_AD) ; 判断给0V电池充电 需一直小PWM
022A   4818           00865       rsubar    vbatAD
022B   3C06           00866       movai     high(LOW_VBAT_AD)
022C   0C19           00867       rsbcar    vbatAD+1
022D   F187           00868       jbclr     C
022E   A000           00869       goto      VBATDaYu3V
022F   3C62           00870       movai     98    ;电池电压小于3v时以小PWM充电
0230   579F           00871       movra     T1DATA
0231   A000           00872       goto      ChargeVBAT_Compare                                                      
                      00873                                                                 
0232                  00874 VBATDaYu3V: ;电池电压高
0232   3C80           00875       movai      low(CONST_VOLTAGE_AD)
0233   4818           00876       rsubar     vbatAD
0234   3C08           00877       movai      high(CONST_VOLTAGE_AD)
0235   0C19           00878       rsbcar     vbatAD+1
0236   E187           00879       jbset      C
0237   A000           00880       goto       DetectionChargeCurrent                                          
                      00881                                                         
0238                  00882 ChargePWM_UP: ;充电用的是PMOS 占空比越大 电流越小
0238   3C62           00883      movai       CHARGE_PWM_DUTY_MAX
0239   499F           00884      rsubar      T1DATA                                                                                                                                  
023A   F187           00885      jbclr       C
023B   A000           00886      goto        ChargeVBAT_Compare
023C   679F           00887      incr        T1DATA                                                                                          
023D   A000           00888      goto        ChargeVBAT_Compare                                                                              
                      00889                                                         
023E                  00890 DetectionChargeCurrent:                                                                                                                                 
023E   3C66           00891     movai        low(CONST_CURRENT_AD)
023F   481A           00892     rsubar       currentAD
0240   3C00           00893     movai        high(CONST_CURRENT_AD)
0241   0C1B           00894     rsbcar       currentAD+1
0242   F187           00895     jbclr        C
0243   A000           00896     goto         ChargePWM_UP
                      00897 
0244                  00898 ChargePWM_DOWN: 
0244   3C0A           00899      movai          CHARGE_PWM_DUTY_MIN
0245   499F           00900      rsubar         T1DATA                                                                                                                          
0246   E187           00901      jbset          C
0247   A000           00902      goto           ChargeVBAT_Compare                                                                                              
0248   6F9F           00903      decr           T1DATA                                                                                                                                                                  
                      00904                         
0249                  00905 ChargeVBAT_Compare:                                                                                                                                                                                     
0249   581C           00906      movar      lastAD
024A   4818           00907      rsubar     vbatAD
024B   581D           00908      movar      lastAD+1
024C   0C19           00909      rsbcar     vbatAD+1
024D   E187           00910      jbset       C
024E   000C           00911      return     
024F   8000           00912      call        _BatteryMode
0250   5818           00913      movar       vbatAD
0251   561C           00914      movra       lastAD
0252   5819           00915      movar       vbatAD+1
0253   561D           00916      movra       lastAD+1
0254   000C           00917      return
                      00918 
0255                  00919 _Boost:
0255   3C00           00920     movai           low(BOOST_5V_CONST_AD)
0256   481E           00921     rsubar          boostAD5V
0257   3C0A           00922     movai           high(BOOST_5V_CONST_AD)
0258   0C1F           00923     rsbcar          boostAD5V+1
0259   F187           00924     jbclr           C           ;<设定值 加大PWM
025A   A000           00925     goto            BoostPWM_DOWN                                                                                       
025B   3C19           00926     movai           BOOST_PWM_DUTY_MAX
025C   499B           00927     rsubar          T0DATA                                                                                                                          
025D   F187           00928     jbclr           C
025E   000C           00929     return                  
025F   679B           00930     incr            T0DATA                                                                                                                                  
0260   000C           00931     return                          
                      00932                                 
0261                  00933 BoostPWM_DOWN:                                                                                                                                                  
0261   3C02           00934      movai          BOOST_PWM_DUTY_MIN
0262   499B           00935      rsubar         T0DATA                                                                                                                          
0263   E187           00936      jbset           C                                                                                                                                                               
0264   000C           00937      return                 
0265   6F9B           00938      decr           T0DATA                                                                                                                                          
0266   000C           00939      return
                      00940                                         
0267                  00941 _DetLoad:               
0267   3C00           00942       movai        low(LOW_VBAT_AD)
0268   4818           00943       rsubar       vbatAD
0269   3C06           00944       movai        high(LOW_VBAT_AD)
026A   0C19           00945       rsbcar       vbatAD+1
026B   E187           00946       jbset        C
026C   A000           00947       goto         LowVbat ; 电池电压低于3V      
026D   EA0D           00948       jbset        F_detLoad
026E   000C           00949       return      
026F   E20D           00950       jbset        F_time100ms
0270   000C           00951       return
0271   D20D           00952       bclr         F_time100ms              
0272   8000           00953       call        _CurrentSampleSbr         
0273   3CEB           00954       movai       low(LOAD_CURRENT_AD_MAX)
0274   481A           00955       rsubar      currentAD
0275   3C00           00956       movai       high(LOAD_CURRENT_AD_MAX)
0276   0C1B           00957       rsbcar      currentAD+1
0277   F187           00958       jbclr       C          ;debug
0278   A000           00959       goto        NoLoad
                      00960       ;jbset     C ; >限流值
                      00961       ;goto      NoOverCurrent ;没有过流 
                      00962       ;bclr      F_detLoad ;停止检测负载 关机
                      00963       ;bclr      F_load
                      00964       ;bclr      BOOST_EN
                      00965       ;bset      F_sleep
                      00966       ;return
                      00967                                 
0279                  00968 NoOverCurrent: ;(无过流)
0279   3C0A           00969          movai         low(LOAD_CURRENT_AD_MIN)
027A   481A           00970          rsubar        currentAD
027B   3C00           00971          movai         high(LOAD_CURRENT_AD_MIN)
027C   0C1B           00972          rsbcar        currentAD+1
027D   E187           00973          jbset         C ; >最小值
027E   A000           00974          goto          NoLoad
027F   7624           00975          clrr          noLoadCnt
0280   6623           00976          incr          loadCnt
0281   3C05           00977          movai         LOAD_CNT
0282   4023           00978          xorar         loadCnt
0283   E587           00979          jbset         Z
0284   000C           00980          return
0285   C40C           00981          bset          F_load
0286   000C           00982          return
                      00983          
0287                  00984 NoLoad:
0287   7623           00985          clrr      loadCnt
0288   6624           00986          incr      noLoadCnt
0289   3C05           00987          movai     NO_LOAD_CNT
028A   4024           00988          xorar     noLoadCnt
028B   E587           00989          jbset     Z
028C   000C           00990          return
028D   D40C           00991          bclr      F_load
028E   000C           00992          return
                      00993                                 
028F                  00994 LowVbat: ;电池没电
028F   D190           00995        bclr      BOOST_EN
0290   D40C           00996        bclr      F_load
0291   D00E           00997        bclr      F_noLoadState
0292   DF98           00998        bclr      TC0EN ;关升压PWM
0293   DD98           00999        bclr      PWM0OE
0294   DD94           01000        bclr      NMOS
                      01001                 
0295   DE0D           01002        bclr      F_displayEn      ;关显示   
0296   D590           01003        bclr      LED12
0297   D790           01004        bclr      LED34
0298   D990           01005        bclr      LED56     ;75%
0299   DB90           01006        bclr      LED78     ;100%        
029A   C591           01007        bset      DDR0,2    ;  
029B   C791           01008        bset      DDR0,3    ;
029C   C991           01009        bset      DDR0,4    ;  
029D   CB91           01010        bset      DDR0,5    ;
029E   C80C           01011        bset      F_sleep
029F   000C           01012        return
                      01013                                 
02A0                  01014 _OffDisplay: ;关显示
02A0   DE0D           01015           bclr     F_displayEn
02A1   D590           01016           bclr     LED12     ;25%
02A2   D790           01017           bclr     LED34     ;50%
02A3   D990           01018           bclr     LED56     ;75%
02A4   DB90           01019           bclr     LED78     ;100%       
02A5   C591           01020           bset     DDR0,2    ;  
02A6   C791           01021           bset     DDR0,3    ;
02A7   C991           01022           bset     DDR0,4    ;  
02A8   CB91           01023           bset     DDR0,5    ;
02A9   000C           01024           return
                      01025 
02AA                  01026 _OffPMOS:
02AA   DF9C           01027           bclr     TC1EN
02AB   DD9C           01028           bclr     PWM1OE
02AC   DFAC           01029           bclr     PWMCR0,7
02AD   DBAC           01030           bclr     PWMCR0,5
02AE   D9AC           01031           bclr     PWMCR0,4  
02AF   CF94           01032           bset     PMOS
02B0   000C           01033           return
                      01034 
02B1                  01035 _OffNMOS:
02B1   DF98           01036           bclr     TC0EN ;关PWM
02B2   DD98           01037           bclr     PWM0OE         
02B3   DD94           01038           bclr     NMOS
02B4   000C           01039           return
                      01040 
02B5                  01041 START:
02B5   8000           01042           call         _Delay    ;FCPU=4M 时延时0.15s
02B6   8000           01043           call        _InitRst
02B7   8000           01044           call        _InitRAM
02B8   CF88           01045           bset        GIE          
02B9   C994           01046           bset        LIGHT_LED   ;开照明灯
02BA   CE0D           01047           bset        F_displayEn
02BB   3C0F           01048           movai       0xf
02BC   560F           01049           movra       ledFlags          
02BD   3C1E           01050           movai        30
02BE   562A           01051           movra        loopCnt
02BF                  01052 LoopDelay:
02BF   8000           01053         call           _Delay
02C0   6A2A           01054         djzr           loopCnt
02C1   A000           01055         goto           LoopDelay        
02C2   D994           01056         bclr           LIGHT_LED      ;关照明灯
02C3   DE0D           01057         bclr           F_displayEn    ;显示使能
02C4   8000           01058         call           _OffDisplay
02C5   760F           01059         clrr           ledFlags        
02C6   8000           01060         call           _Delay        
02C7   8000           01061         call           _BatSampleSbr
02C8   5818           01062         movar          vbatAD
02C9   561C           01063         movra          lastAD    ;上一次值
02CA   5819           01064         movar          vbatAD+1
02CB   561D           01065         movra          lastAD+1
02CC   8000           01066         call           _BatteryMode
02CD   8000           01067         call           _DisplayPrcess                
                      01068         
02CE                  01069 main:
02CE   8000           01070         call           _Boost5VSampleSbr
                      01071         ;call          _CurrentSampleSbr
                      01072         ;call          _BatSampleSbr
02CF   8000           01073         call           _TimeBase
02D0   8000           01074         call           _KeyScan
02D1   8000           01075         call           _KeyDeal
                      01076                                 
02D2                  01077 LongKeyProcess:
02D2   3C02           01078               movai     LONG_KEY
02D3   4004           01079               xorar     keyCode   ;异或的结果为0，则1→Z(相等)；否则0→Z
02D4   E587           01080               jbset     Z
02D5   A000           01081               goto      ShortKeyProcess 
02D6   FC0D           01082               jbclr     F_lightSwitch   
02D7   A000           01083               goto      GuanZhaoMing            
02D8   CC0D           01084               bset      F_lightSwitch
02D9   C994           01085               bset      LIGHT_LED
02DA   A000           01086               goto      JianChePower5v
                      01087               
02DB                  01088 GuanZhaoMing:
02DB   DC0D           01089               bclr      F_lightSwitch
02DC   D994           01090               bclr      LIGHT_LED
02DD   A000           01091               goto      JianChePower5v
                      01092                                 
02DE                  01093 ShortKeyProcess:        
02DE   3C01           01094            movai      SHORT_KEY
02DF   4004           01095            xorar      keyCode
02E0   E587           01096            jbset      Z
02E1   A000           01097            goto       JianChePower5v           
02E2   F60C           01098            jbclr      F_power5V   ;检测5V接入
02E3   A000           01099            goto       JianChePower5v
02E4   F40C           01100            jbclr      F_load     ;负载标志 1 active(有效)
02E5   A000           01101            goto       JianChePower5v           
02E6   760B           01102            clrr       sleepTime  
02E7   7623           01103            clrr       loadCnt 
02E8   7624           01104            clrr       noLoadCnt
02E9   3C01           01105            movai      1
02EA   579B           01106            movra      T0DATA
02EB   3CB0           01107            movai      0xb0       ;升压PWM设置 开启bit7 bit5 bit4
02EC   57AC           01108            movra      PWMCR0
02ED   CD98           01109            bset       PWM0OE
02EE   CF98           01110            bset       TC0EN
                      01111            
02EF   C190           01112            bset       BOOST_EN
02F0   CA0D           01113            bset       F_detLoad ; 可以检测负载
02F1   CE0D           01114            bset       F_displayEn ; 开显示
02F2   C00E           01115            bset       F_noLoadState
                      01116         
02F3                  01117 JianChePower5v:                 
02F3   E594           01118             jbset      CHRG  ;为高表示有5V接入
02F4   A000           01119             goto       NoPower5V
02F5   F60C           01120             jbclr      F_power5V
02F6   A000           01121             goto       Charge_Discharge_Process ;充放电处理
02F7   6628           01122             incr       filterCnt ; 5V接入去抖动
02F8   3C64           01123             movai      100
02F9   4028           01124             xorar      filterCnt
02FA   E587           01125             jbset      Z
02FB   A000           01126             goto       Charge_Discharge_Process
02FC   7628           01127             clrr       filterCnt
                      01128             
02FD   C60C           01129             bset       F_power5V
02FE   760B           01130             clrr       sleepTime
                      01131             
02FF   D40C           01132             bclr       F_load ; 关放电部分
0300   DA0D           01133             bclr       F_detLoad
0301   D00E           01134             bclr       F_noLoadState
0302   D190           01135             bclr       BOOST_EN
                      01136             
0303   8000           01137             call       _OffNMOS
                      01138             
0304   CE0D           01139             bset       F_displayEn ; 开显示使能
                      01140             
0305   3C62           01141             movai      98 ;  赋初始值
0306   579F           01142             movra      T1DATA
0307   CF9C           01143             bset       TC1EN ; 开启PMOS
0308   CD9C           01144             bset       PWM1OE  
0309   A000           01145             goto       Charge_Discharge_Process ;充放电过程
                      01146             
030A                  01147 NoPower5V:
030A   8000           01148             call       _DetLoad
030B   E60C           01149             jbset      F_power5V
030C   A000           01150             goto       Charge_Discharge_Process
030D   D60C           01151             bclr       F_power5V
030E   D40D           01152             bclr       F_chargeFull
030F   7628           01153             clrr       filterCnt
0310   8000           01154             call       _OffPMOS
0311   8000           01155             call       _OffDisplay
                      01156                                 
0312                  01157 Charge_Discharge_Process:
0312   E60C           01158                    jbset      F_power5V ;充电
0313   A000           01159                    goto       DischargeProcess ;放电过程
0314   8000           01160                    call       _Charging
0315   A000           01161                    goto       Dispaly 
                      01162                                 
0316                  01163 DischargeProcess: ;放电
0316   E40C           01164                jbset      F_load
0317   A000           01165                goto       NoLoadState               
0318   760B           01166                clrr       sleepTime               
0319   E80D           01167                jbset      F_time500ms
031A   A000           01168                goto       BoostStatus 
031B   D80D           01169                bclr       F_time500ms                             
031C   8000           01170                call       _BatSampleSbr                          
031D   581C           01171                movar      lastAD
031E   4818           01172                rsubar     vbatAD
031F   581D           01173                movar      lastAD+1
0320   0C19           01174                rsbcar     vbatAD+1
0321   F187           01175                jbclr       C 
0322   A000           01176                goto        BoostStatus 
0323   8000           01177                call        _BatteryMode
0324   5818           01178                movar       vbatAD
0325   561C           01179                movra       lastAD
0326   5819           01180                movar       vbatAD+1
0327   561D           01181                movra       lastAD+1
                      01182                
0328                  01183 BoostStatus: 
0328   8000           01184             call        _Boost
0329   A000           01185             goto        Dispaly 
032A                  01186 NoLoadState:
032A   F00E           01187          jbclr       F_noLoadState
032B   A000           01188          goto        BoostStatus 
                      01189         
032C                  01190 Dispaly:
032C   EE0D           01191          jbset       F_displayEn
032D   A000           01192          goto        ToSleep
032E   8000           01193          call        _DisplayPrcess
                      01194 
032F                  01195 ToSleep:
032F   E80C           01196          jbset      F_sleep
0330   A000           01197          goto       main
0331   D80C           01198          bclr       F_sleep
0332   DA0D           01199          bclr       F_detLoad
0333   D00E           01200          bclr       F_noLoadState
0334   D190           01201          bclr       BOOST_EN
0335   DF98           01202          bclr       TC0EN
0336   DD98           01203          bclr       PWM0OE
0337   DF9C           01204          bclr       TC1EN     ;关PWM
0338   DD9C           01205          bclr       PWM1OE
0339   DFAC           01206          bclr       PWMCR0,7
033A   DBAC           01207          bclr       PWMCR0,5
033B   D9AC           01208          bclr       PWMCR0,4
033C   CF94           01209          bset       PMOS
033D   DD94           01210          bclr       NMOS
033E   DE0D           01211          bclr       F_displayEn             
033F   D590           01212          bclr       LED12
0340   D790           01213          bclr       LED34
0341   D990           01214          bclr       LED56
0342   DB90           01215          bclr       LED78         
0343   D591           01216          bclr       DDR0,2
0344   D791           01217          bclr       DDR0,3
0345   D991           01218          bclr       DDR0,4
0346   DB91           01219          bclr       DDR0,5         
0347   C98A           01220          bset       KBIE     ;键盘中断使能
0348   D594           01221          bclr       P1,2
0349   0000           01222          nop
034A   0000           01223          nop
034B   0000           01224          nop
034C   000B           01225          stop
034D   0000           01226          nop
034E   0000           01227          nop
034F   0000           01228          nop
0350   D98A           01229          bclr       KBIE
0351   0000           01230          nop
0352   761A           01231          clrr       currentAD
0353   761B           01232          clrr       currentAD+1
0354   A000           01233          goto       main         
                      01234          en
gpasm-1.7.0_beta1 (Feb  6 2015)D:\ZMJWork\project\MC32P7311\luozheng_demo\zmj7311\Mobile_BAT\mobile_bat0717_new.asm2015-7-30  17:38:24          PAGE  2


SYMBOL TABLE
  LABEL                             VALUE

ADCR0                             000001B0
ADCR1                             000001B1
ADCR2                             000001B2
ADRH                              000001B4
ADRL                              000001B5
ADSampling                        000001CD
ANSEL0                            000001B6
ANSEL1                            000001B7
AdjustChargePWM                   00000229
BatteryFull                       0000020E
BatteryFullOfCnt                  00000215
BatteryNotFull                    00000227
Battery_MODE_1                    000000CF
Battery_MODE_2                    000000D7
Battery_MODE_3                    000000DF
Battery_MODE_4                    000000E7
BlinkMode_1_OFF                   00000157
BlinkMode_2_OFF                   0000016E
BlinkMode_3_OFF                   00000185
BlinkMode_4_OFF                   0000019C
BlinkMode_5_OFF                   000001B3
BoostPWM_DOWN                     00000261
BoostStatus                       00000328
ChargePWM_DOWN                    00000244
ChargePWM_UP                      00000238
ChargeVBAT_Compare                00000249
Charge_Discharge_Process          00000312
DRVCR                             0000018C
DelayCnt                          00000002
DelayCnt1                         00000003
Delay_1                           00000071
Delay_2                           00000073
DetectionChargeCurrent            0000023E
DetectionChargeVBAT               00000220
DischargeProcess                  00000316
Dispaly                           0000032C
DisplayLED2                       0000010C
DisplayLED3                       00000116
DisplayLED4                       00000120
DisplayMode_1                     00000144
DisplayMode_2                     0000015D
DisplayMode_3                     00000174
DisplayMode_4                     0000018B
DisplayMode_5                     000001A2
ExitInterrupt                     0000002B
ExitKeyDeal                       000000A5
ExitKeyScan                       00000092
Exit_Battery_MODE                 000000E8
FSR0                              00000184
FSR1                              00000185
Flag                              0000000C
Flag1                             0000000D
Flag2                             0000000E
GetADValue                        000001C2
Get_AD_AVG                        000001D6
Get_AD_AVG_1                      000001DB
GuanZhaoMing                      000002DB
HIBYTE                            00000183
INDF0                             00000180
INDF1                             00000181
INDF2                             00000182
INDF3                             00000189
INT0_IRQ                          00000022
INT1_IRQ                          00000025
INTE                              0000018A
INTF                              0000018B
IOP0                              00000190
IOP1                              00000194
InitRAM0                          00000068
InterruptVector                   00000008
JianChePower5v                    000002F3
JudgeShortKey                     0000009F
KBCR                              0000018E
KBIM_IRQ                          00000028
LEDScan                           0000012B
LED_OFF                           0000012A
LVDCR                             000001AF
LoadMode_1                        0000014E
LoadMode_2                        00000167
LoadMode_3                        0000017E
LoadMode_4                        00000195
LoadMode_5                        000001AC
LongKeyProcess                    000002D2
LoopDelay                         000002BF
LowVbat                           0000028F
MCR                               00000188
NoKeyPress                        00000089
NoLoad                            00000287
NoLoadMode_1                      0000015A
NoLoadMode_2                      00000171
NoLoadMode_3                      00000188
NoLoadMode_4                      0000019F
NoLoadMode_5                      000001B6
NoLoadState                       0000032A
NoOverCurrent                     00000279
NoPower5V                         0000030A
OEP0                              00000191
OEP1                              00000195
OSCCAL0                           000001FC
OSCCAL1                           000001FB
OSCM                              000001AE
PCL                               00000186
PDP0                              00000193
PDP1                              00000197
PFLAG                             00000187
PUP0                              00000192
PUP1                              00000196
PWM0DE                            000001A8
PWM1DE                            000001A9
PWM2DE                            000001AA
PWMCR0                            000001AC
PWMCR1                            000001AD
START                             000002B5
ShortKeyProcess                   000002DE
T0CNT                             00000199
T0CR                              00000198
T0DATA                            0000019B
T0LOAD                            0000019A
T1CNT                             0000019D
T1CR                              0000019C
T1DATA                            0000019F
T1LOAD                            0000019E
T2CNT                             000001A1
T2CR                              000001A0
T2DATA                            000001A3
T2LOAD                            000001A2
T3CNT                             000001A5
T3CR                              000001A4
T3LOAD                            000001A6
TIM0_IRQ                          0000000B
TIM1_IRQ                          0000000E
TIM2_IRQ                          00000011
TIM3_IRQ                          00000014
TimeAccumulation                  0000001B
ToSleep                           0000032F
VBATDaYu3V                        00000232
VBGCAL                            000001F8
_.org_8_01BB                      000001BB
_ADCSbr                           000001B9
_BatSampleSbr                     000001E5
_BatteryMode                      000000C7
_Boost                            00000255
_Boost5VSampleSbr                 000001F5
_BrightLED1                       000000EA
_BrightLED2                       000000EF
_BrightLED3                       000000F4
_BrightLED4                       000000F9
_Charging                         000001FD
_CurrentSampleSbr                 000001ED
_Delay                            0000006F
_DetLoad                          00000267
_DisplayLED                       00000103
_DisplayPrcess                    0000013F
_InitRAM                          00000067
_InitRst                          0000002F
_KeyDeal                          00000095
_KeyScan                          00000078
_MarqueeLED                       00000132
_MultipleADSampling               000001C9
_OFF_LED                          000000FE
_OffDisplay                       000002A0
_OffNMOS                          000002B1
_OffPMOS                          000002AA
_TimeBase                         000000A8
__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
main                              000002CE
marqueeLEDFlags                   00000029
noLoadCnt                         00000024
sleepTime                         0000000B
statusTemp                        00000001
sumAD                             00000014
time_100ms                        00000009
time_10ms                         00000008
time_1ms                          00000007
time_500ms                        0000000A
vbatAD                            00000018
ADCHS0                            ADCR0,4
ADCHS1                            ADCR0,5
ADCHS2                            ADCR0,6
ADCHS3                            ADCR0,7
ADCKS0                            ADCR1,5
ADCKS1                            ADCR1,6
ADCKS2                            ADCR1,7
ADEOC                             ADCR0,1
ADIE                              INTE,6
ADIF                              INTFLAG,6
ADLEN                             ADCR0,3
ADON                              ADCR0,0
ADR0                              ADRL,0
ADR1                              ADRL,1
ADR10                             ADRH,6
ADR11                             ADRH,7
ADR2                              ADRL,2
ADR3                              ADRL,3
ADR4                              ADRH,0
ADR5                              ADRH,1
ADR6                              ADRH,2
ADR7                              ADRH,3
ADR8                              ADRH,4
ADR9                              ADRH,5
ADSMP0                            ADCR2,0
ADSMP1                            ADCR2,1
ADSMP2                            ADCR2,2
ADSMP3                            ADCR2,3
ADTST                             ADCR1,4
BAT_ADCH                          0xc9
BOOST5V_ADCH                      0xb9
BOOST_5V_CONST_AD                 2560
BOOST_EN                          P0,0
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,2
CLKS                              OSCM,2
CONST_CURRENT_AD                  102
CONST_VOLTAGE_AD                  2176
CURRENT_ADCH                      0x59
DC                                PFLAG,1
DDR0                              OEP0
DDR1                              OEP1
DET_CURRENT                       P1,0
DRVS                              DRVCR,7
FPWMEN                            PWMCR0,7
FPWMF0                            PWMCR0,0
FPWMF1                            PWMCR0,1
FPWMR0                            PWMCR0,2
FPWMR1                            PWMCR0,3
FSR                               FSR0
FSR00                             FSR0,0
FSR01                             FSR0,1
FSR02                             FSR0,2
FSR03                             FSR0,3
FSR04                             FSR0,4
FSR05                             FSR0,5
FSR06                             FSR0,6
FSR07                             FSR0,7
FSR10                             FSR1,0
FSR11                             FSR1,1
FSR12                             FSR1,2
FSR13                             FSR1,3
FSR14                             FSR1,4
FSR15                             FSR1,5
FSR16                             FSR1,6
FSR17                             FSR1,7
FULL_VOLTAGE_AD                   2190
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
HIBYTE0                           HIBYTE,0
HIBYTE1                           HIBYTE,1
HIBYTE2                           HIBYTE,2
HIBYTE3                           HIBYTE,3
HIBYTE4                           HIBYTE,4
HIBYTE5                           HIBYTE,5
HIBYTE6                           HIBYTE,6
HIBYTE7                           HIBYTE,7
INDF                              INDF0
INDF00                            INDF0,0
INDF01                            INDF0,1
INDF02                            INDF0,2
INDF03                            INDF0,3
INDF04                            INDF0,4
INDF05                            INDF0,5
INDF06                            INDF0,6
INDF07                            INDF0,7
INDF10                            INDF1,0
INDF11                            INDF1,1
INDF12                            INDF1,2
INDF13                            INDF1,3
INDF14                            INDF1,4
INDF15                            INDF1,5
INDF16                            INDF1,6
INDF17                            INDF1,7
INDF20                            INDF2,0
INDF21                            INDF2,1
INDF22                            INDF2,2
INDF23                            INDF2,3
INDF24                            INDF2,4
INDF25                            INDF2,5
INDF26                            INDF2,6
INDF27                            INDF2,7
INDF30                            INDF3,0
INDF31                            INDF3,1
INDF32                            INDF3,2
INDF33                            INDF3,3
INDF34                            INDF3,4
INDF35                            INDF3,5
INDF36                            INDF3,6
INDF37                            INDF3,7
INT0IE                            INTE,2
INT0IF                            INTFLAG,2
INT1IE                            INTE,3
INT1IF                            INTFLAG,3
INTECON                           INTE
INTFLAG                           INTF
KBCR0                             KBCR,0
KBCR1                             KBCR,1
KBCR2                             KBCR,2
KBCR3                             KBCR,3
KBCR4                             KBCR,4
KBCR5                             KBCR,5
KBCR6                             KBCR,6
KBIE                              INTE,4
KBIF                              INTFLAG,4
KEY_EFFECT                        100
KEY_I                             P1,1
LDRVS                             DRVCR,6
LED12                             P0,2
LED34                             P0,3
LED56                             P0,4
LED78                             P0,5
LFEN                              OSCM,1
LIGHT_LED                         P1,4
LOAD_CNT                          5
LOAD_CURRENT_AD_MAX               235
LOAD_CURRENT_AD_MIN               10
LONG_KEY                          2
LOW_VBAT_AD                       1536
LVDEN                             LVDCR,7
LVDF                              LVDCR,0
LVDS0                             LVDCR,3
LVDS1                             LVDCR,4
LVDS2                             LVDCR,5
LVDS3                             LVDCR,6
MINT00                            MCR,0
MINT01                            MCR,1
MINT10                            MCR,2
MINT11                            MCR,3
NMOS                              P1,6
NO_KEY                            0
NO_LOAD_CNT                       5
OSCCAL0                           OSCCAL0,0
OSCCAL1                           OSCCAL0,1
OSCCAL10                          OSCCAL1,2
OSCCAL2                           OSCCAL0,2
OSCCAL3                           OSCCAL0,3
OSCCAL4                           OSCCAL0,4
OSCCAL5                           OSCCAL0,5
OSCCAL6                           OSCCAL0,6
OSCCAL7                           OSCCAL0,7
OSCCAL8                           OSCCAL1,0
OSCCAL9                           OSCCAL1,1
P0                                IOP0
P00ANS                            ANSEL0,0
P00D                              IOP0,0
P00OE                             OEP0,0
P00PD                             PDP0,0
P00PU                             PUP0,0
P01ANS                            ANSEL0,1
P01D                              IOP0,1
P01OE                             OEP0,1
P01PD                             PDP0,1
P01PU                             PUP0,1
P02ANS                            ANSEL0,2
P02D                              IOP0,2
P02OE                             OEP0,2
P02PD                             PDP0,2
P02PU                             PUP0,2
P03ANS                            ANSEL0,3
P03D                              IOP0,3
P03OE                             OEP0,3
P03PD                             PDP0,3
P03PU                             PUP0,3
P04ANS                            ANSEL0,4
P04D                              IOP0,4
P04OE                             OEP0,4
P04PD                             PDP0,4
P04PU                             PUP0,4
P05ANS                            ANSEL0,5
P05D                              IOP0,5
P05OE                             OEP0,5
P05PD                             PDP0,5
P05PU                             PUP0,5
P0HCON                            PUP0
P1                                IOP1
P10D                              IOP1,0
P10OE                             OEP1,0
P10PD                             PDP1,0
P10PU                             PUP1,0
P11ANS                            ANSEL0,6
P11D                              IOP1,1
P11OE                             OEP1,1
P11PD                             PDP1,1
P11PU                             PUP1,1
P12ANS                            ANSEL0,7
P12D                              IOP1,2
P12OE                             OEP1,2
P12PD                             PDP1,2
P12PU                             PUP1,2
P13D                              IOP1,3
P13OE                             OEP1,3
P13PD                             PDP1,3
P13PU                             PUP1,3
P14ANS                            ANSEL1,0
P14D                              IOP1,4
P14OE                             OEP1,4
P14PD                             PDP1,4
P14PU                             PUP1,4
P15ANS                            ANSEL1,1
P15D                              IOP1,5
P15OE                             OEP1,5
P15PD                             PDP1,5
P15PU                             PUP1,5
P16D                              IOP1,6
P16OE                             OEP1,6
P16PD                             PDP1,6
P16PU                             PUP1,6
P17D                              IOP1,7
P17OE                             OEP1,7
P17PD                             PDP1,7
P17PU                             PUP1,7
P1HCON                            PUP1
PC0                               PCL,0
PC1                               PCL,1
PC2                               PCL,2
PC3                               PCL,3
PC4                               PCL,4
PC5                               PCL,5
PC6                               PCL,6
PC7                               PCL,7
PD                                MCR,4
PDLYS0                            DRVCR,2
PDLYS1                            DRVCR,3
PDRVS                             DRVCR,5
PDRVS0                            DRVCR,4
PMODE0                            PWMCR1,0
PMODE1                            PWMCR1,1
PMODE2                            PWMCR1,2
PMOS                              P1,7
PSPDS0                            DRVCR,0
PSPDS1                            DRVCR,1
PWM0DE0                           PWM0DE,0
PWM0DE1                           PWM0DE,1
PWM0DE2                           PWM0DE,2
PWM0INV                           PWMCR0,4
PWM0OE                            T0CR,6
PWM1DE0                           PWM1DE,0
PWM1DE1                           PWM1DE,1
PWM1DE2                           PWM1DE,2
PWM1INV                           PWMCR0,5
PWM1OE                            T1CR,6
PWM2DE0                           PWM2DE,0
PWM2DE1                           PWM2DE,1
PWM2DE2                           PWM2DE,2
PWM2INV                           PWMCR0,6
PWM2OE                            T2CR,6
RESS0                             ADCR1,3
SHORT_CIRCUIT_AD                  434
SHORT_KEY                         1
SHUT_OFF_CURRENT_AD               10
STATUS                            PFLAG
STBH                              OSCM,4
STBL                              OSCM,5
T0                                MCR,5
T0C0                              T0CNT,0
T0C1                              T0CNT,1
T0C2                              T0CNT,2
T0C3                              T0CNT,3
T0C4                              T0CNT,4
T0C5                              T0CNT,5
T0C6                              T0CNT,6
T0C7                              T0CNT,7
T0DATA0                           T0DATA,0
T0DATA1                           T0DATA,1
T0DATA2                           T0DATA,2
T0DATA3                           T0DATA,3
T0DATA4                           T0DATA,4
T0DATA5                           T0DATA,5
T0DATA6                           T0DATA,6
T0DATA7                           T0DATA,7
T0IE                              INTE,0
T0IF                              INTFLAG,0
T0LOAD0                           T0LOAD,0
T0LOAD1                           T0LOAD,1
T0LOAD2                           T0LOAD,2
T0LOAD3                           T0LOAD,3
T0LOAD4                           T0LOAD,4
T0LOAD5                           T0LOAD,5
T0LOAD6                           T0LOAD,6
T0LOAD7                           T0LOAD,7
T0PR0                             T0CR,0
T0PR1                             T0CR,1
T0PR2                             T0CR,2
T0PS0                             T0CR,3
T0PS1                             T0CR,4
T1C0                              T1CNT,0
T1C1                              T1CNT,1
T1C2                              T1CNT,2
T1C3                              T1CNT,3
T1C4                              T1CNT,4
T1C5                              T1CNT,5
T1C6                              T1CNT,6
T1C7                              T1CNT,7
T1DATA0                           T1DATA,0
T1DATA1                           T1DATA,1
T1DATA2                           T1DATA,2
T1DATA3                           T1DATA,3
T1DATA4                           T1DATA,4
T1DATA5                           T1DATA,5
T1DATA6                           T1DATA,6
T1DATA7                           T1DATA,7
T1IE                              INTE,1
T1IF                              INTFLAG,1
T1LOAD0                           T1LOAD,0
T1LOAD1                           T1LOAD,1
T1LOAD2                           T1LOAD,2
T1LOAD3                           T1LOAD,3
T1LOAD4                           T1LOAD,4
T1LOAD5                           T1LOAD,5
T1LOAD6                           T1LOAD,6
T1LOAD7                           T1LOAD,7
T1PR0                             T1CR,0
T1PR1                             T1CR,1
T1PR2                             T1CR,2
T1PS0                             T1CR,3
T1PS1                             T1CR,4
T2C0                              T2CNT,0
T2C1                              T2CNT,1
T2C2                              T2CNT,2
T2C3                              T2CNT,3
T2C4                              T2CNT,4
T2C5                              T2CNT,5
T2C6                              T2CNT,6
T2C7                              T2CNT,7
T2DATA0                           T2DATA,0
T2DATA1                           T2DATA,1
T2DATA2                           T2DATA,2
T2DATA3                           T2DATA,3
T2DATA4                           T2DATA,4
T2DATA5                           T2DATA,5
T2DATA6                           T2DATA,6
T2DATA7                           T2DATA,7
T2IE                              INTE,5
T2IF                              INTFLAG,5
T2LOAD0                           T2LOAD,0
T2LOAD1                           T2LOAD,1
T2LOAD2                           T2LOAD,2
T2LOAD3                           T2LOAD,3
T2LOAD4                           T2LOAD,4
T2LOAD5                           T2LOAD,5
T2LOAD6                           T2LOAD,6
T2LOAD7                           T2LOAD,7
T2PR0                             T2CR,0
T2PR1                             T2CR,1
T2PR2                             T2CR,2
T2PS0                             T2CR,3
T2PS1                             T2CR,4
T3C0                              T3CNT,0
T3C1                              T3CNT,1
T3C2                              T3CNT,2
T3C3                              T3CNT,3
T3C4                              T3CNT,4
T3C5                              T3CNT,5
T3C6                              T3CNT,6
T3C7                              T3CNT,7
T3IE                              INTE,7
T3IF                              INTFLAG,7
T3LOAD0                           T3LOAD,0
T3LOAD1                           T3LOAD,1
T3LOAD2                           T3LOAD,2
T3LOAD3                           T3LOAD,3
T3LOAD4                           T3LOAD,4
T3LOAD5                           T3LOAD,5
T3LOAD6                           T3LOAD,6
T3LOAD7                           T3LOAD,7
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
TMRCKS0                           PWMCR1,3
TMRCKS1                           PWMCR1,4
VBAT_AD0                          1638
VBAT_AD1                          1792
VBAT_AD2                          1920
VBAT_AD3                          1997
VBGCAL0                           VBGCAL,0
VBGCAL1                           VBGCAL,1
VBGCAL2                           VBGCAL,2
VBGCAL3                           VBGCAL,3
VBGCAL4                           VBGCAL,4
VBGCAL5                           VBGCAL,5
VBGCAL6                           VBGCAL,6
VBGCAL7                           VBGCAL,7
VRS0                              ADCR1,0
VRS1                              ADCR1,1
VRS2                              ADCR1,2
Z                                 PFLAG,2

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

