gpasm-1.7.0_beta1 (Feb  6 2015)D:\ZMJWork\project\MC32P7311\luozheng_demo\zmj7311\Mobile_BAT\mobile_bat.asm2015-7-29  15:38:14          PAGE  1


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

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


SYMBOL TABLE
  LABEL                             VALUE

ADCR0                             000001B0
ADCR1                             000001B1
ADCR2                             000001B2
ADRH                              000001B4
ADRL                              000001B5
ADSampling                        000001BD
ANSEL0                            000001B6
ANSEL1                            000001B7
AdjustChargePWM                   00000219
BatteryFull                       000001FE
BatteryFullOfCnt                  00000205
BatteryNotFull                    00000217
Battery_MODE_1                    000000C0
Battery_MODE_2                    000000C8
Battery_MODE_3                    000000D0
Battery_MODE_4                    000000D8
BlinkMode_1_OFF                   00000147
BlinkMode_2_OFF                   0000015E
BlinkMode_3_OFF                   00000175
BlinkMode_4_OFF                   0000018C
BlinkMode_5_OFF                   000001A3
BoostPWM_DOWN                     00000251
BoostStatus                       00000312
ChargePWM_DOWN                    00000234
ChargePWM_UP                      00000228
ChargeVBAT_Compare                00000239
Charge_Discharge_Process          000002FC
DRVCR                             0000018C
DelayCnt                          00000002
DelayCnt1                         00000003
Delay_1                           00000062
Delay_2                           00000064
DetectionChargeCurrent            0000022E
DetectionChargeVBAT               00000210
DischargeProcess                  00000300
Dispaly                           00000316
DisplayLED2                       000000FC
DisplayLED3                       00000106
DisplayLED4                       00000110
DisplayMode_1                     00000134
DisplayMode_2                     0000014D
DisplayMode_3                     00000164
DisplayMode_4                     0000017B
DisplayMode_5                     00000192
ExitInterrupt                     00000028
ExitKeyDeal                       00000096
ExitKeyScan                       00000083
Exit_Battery_MODE                 000000D9
FSR0                              00000184
FSR1                              00000185
Flag                              0000000C
Flag1                             0000000D
Flag2                             0000000E
GetADValue                        000001B2
Get_AD_AVG                        000001C6
Get_AD_AVG_1                      000001CB
GuanZhaoMing                      000002C5
HIBYTE                            00000183
INDF0                             00000180
INDF1                             00000181
INDF2                             00000182
INDF3                             00000189
INT0_IRQ                          0000001F
INT1_IRQ                          00000022
INTE                              0000018A
INTF                              0000018B
IOP0                              00000190
IOP1                              00000194
InitRAM0                          00000059
InterruptVector                   00000008
JianChePower5v                    000002DD
JudgeShortKey                     00000090
KBCR                              0000018E
KBIM_IRQ                          00000025
LEDScan                           0000011B
LED_OFF                           0000011A
LVDCR                             000001AF
LoadMode_1                        0000013E
LoadMode_2                        00000157
LoadMode_3                        0000016E
LoadMode_4                        00000185
LoadMode_5                        0000019C
LongKeyProcess                    000002BC
LoopDelay                         000002A9
LowVbat                           0000027F
MCR                               00000188
NoKeyPress                        0000007A
NoLoad                            00000277
NoLoadMode_1                      0000014A
NoLoadMode_2                      00000161
NoLoadMode_3                      00000178
NoLoadMode_4                      0000018F
NoLoadMode_5                      000001A6
NoLoadState                       00000314
NoOverCurrent                     00000269
NoPower5V                         000002F4
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                             0000029F
ShortKeyProcess                   000002C8
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
TimeAccumulation                  00000018
ToSleep                           00000319
VBATDaYu3V                        00000222
VBGCAL                            000001F8
_.org_8_01AB                      000001AB
_ADCSbr                           000001A9
_BatSampleSbr                     000001D5
_BatteryMode                      000000B8
_Boost                            00000245
_Boost5VSampleSbr                 000001E5
_BrightLED1                       000000DB
_BrightLED2                       000000E1
_BrightLED3                       000000E5
_BrightLED4                       000000EB
_Charging                         000001ED
_CurrentSampleSbr                 000001DD
_Delay                            00000060
_DetLoad                          00000257
_DisplayLED                       000000F3
_DisplayPrcess                    0000012F
_InitRAM                          00000058
_InitRst                          0000002C
_KeyDeal                          00000086
_KeyScan                          00000069
_MarqueeLED                       00000122
_MultipleADSampling               000001B9
_OFF_LED                          000000EF
_OffDisplay                       0000028D
_OffNMOS                          00000298
_OffPMOS                          00000294
_TimeBase                         00000099
__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                              000002B8
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                          0x7d
BOOST5V_ADCH                      0x6d
BOOST_5V_CONST_AD                 2730
BOOST_EN                          P0,5
BOOST_PWM_DUTY_MAX                25
BOOST_PWM_DUTY_MIN                2
BUZ0OE                            T0CR,5
BUZ1OE                            T1CR,5
BUZ2OE                            T2CR,5
C                                 PFLAG,0
CHARGE_FULL_CNT                   100
CHARGE_PWM_DUTY_MAX               98
CHARGE_PWM_DUTY_MIN               10
CHRG                              P1,3
CLKS                              OSCM,2
CONST_CURRENT_AD                  82
CONST_VOLTAGE_AD                  2320
CURRENT_ADCH                      0x1d
DC                                PFLAG,1
DDR0                              OEP0
DDR1                              OEP1
DET_CURRENT                       P0,2
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                   2370
F_blink                           Flag,7
F_chargeFull                      Flag1,2
F_detLoad                         Flag1,5
F_displayEn                       Flag1,7
F_keyRelease                      Flag,0
F_keyValid                        Flag,1
F_ledOff                          Flag,5
F_lightSwitch                     Flag1,6
F_load                            Flag,2
F_marquee500ms                    Flag2,1
F_noLoadState                     Flag2,0
F_power5V                         Flag,3
F_preCharge                       Flag1,3
F_showVBAT                        Flag,6
F_sleep                           Flag,4
F_time100ms                       Flag1,1
F_time10ms                        Flag1,0
F_time500ms                       Flag1,4
GIE                               MCR,7
HFEN                              OSCM,0
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                             P1,5
LED34                             P1,4
LEDCOM                            P1,2
LFEN                              OSCM,1
LIGHT_LED                         P1,0
LOAD_CNT                          5
LOAD_CURRENT_AD_MAX               188
LOAD_CURRENT_AD_MIN               8
LONG_KEY                          2
LOW_VBAT_AD                       1638
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,7
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,6
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                  400
SHORT_KEY                         1
SHUT_OFF_CURRENT_AD               8
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                          1747
VBAT_AD1                          1911
VBAT_AD2                          2047
VBAT_AD3                          2129
VBGCAL0                           VBGCAL,0
VBGCAL1                           VBGCAL,1
VBGCAL2                           VBGCAL,2
VBGCAL3                           VBGCAL,3
VBGCAL4                           VBGCAL,4
VBGCAL5                           VBGCAL,5
VBGCAL6                           VBGCAL,6
VBGCAL7                           VBGCAL,7
VREF                              P0,4
VRS0                              ADCR1,0
VRS1                              ADCR1,1
VRS2                              ADCR1,2
Z                                 PFLAG,2

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

