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

📄 f6.lst

📁 用PIC单片机18F6520+ADE7755实现的一个大安培、锂离子电池的化程器。全部源码
💻 LST
📖 第 1 页 / 共 5 页
字号:
  0000005C            00535 DisCHTerV_MID   equ     H'5C'
  00000001            00536 DisCHTerV_HI    equ     H'01'           ;2.7V
                      00537 
                      00029         
                      00030 ;------------------------------------------------------------------------
                      00031 ;
                      00032 ; Reset address. Determine type of RESET
                      00033 ;
                      00034         org     RESET_V                         ; Reset vector
0000                  00035 RESET:
                      00036         ifdef PIC16F73
                      00037                 BSF     STATUS, RP0             ; Bank 1
                      00038                 btfss   PCON,NOT_POR            ; Power-up reset?(低有效)
                      00039         else
0000   0000           00040                 nop
                      00041         endif
0001   2???           00042                 goto    Start                   ; YES
0002   2???           00043                 GOTO    MCLR_RESET              ; NO, a WDT or MCLR reset
                      00044 
MPASM 03.20.09 Released                                F6.ASM   7-15-2003  9:14:33         PAGE  2


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00045     page
                      00046         org     ISR_V                           ; Interrupt vector location
                      00047 
0004   00FF           00048                 movwf   W_TEMP                  ; save context before executing
0005   0E03           00049                 swapf   STATUS,W                ; ISR (Interrupt Service Routine)
0006   1683           00050                 bsf     STATUS,RP0              ; SFR bank 1
0007   00FC           00051                 movwf   STATUS_TEMP
0008   0804           00052                 movf    FSR,W
0009   00FD           00053                 movwf   FSR_TEMP
000A   080A           00054                 movf    PCLATH,W
000B   00FE           00055                 movwf   PCLATH_TEMP
000C   1283           00056                 bcf     STATUS,RP0              ; SFR bank 0
000D   118A           00057                 bcf     PCLATH,3                ; Prog page 0
                      00058 
                      00059 ; Find out which flag caused the interrupt, then branch to apropriate subroutine
                      00060 ;               btfsc   INTCON,INTF             ; RB0/INT flag
                      00061 ;               goto    RB0ISR                  ; waveform sample available
                      00062 
000E   1C0C           00063                 btfss   PIR1, TMR1IF            ; TMR1 Overflow Interrupt occured?
000F   2???           00064                 goto    ISR2
0010   158A           00065                 bsf     PCLATH,3
0011   2???           00066                 goto    T1OVFL                  ; YES, Service the TMR1 Interrupt
0012                  00067 ISR2:
0012   1E8C           00068                 btfss   PIR1, RCIF
0013   2???           00069                 goto    END_ISR
0014   158A           00070                 bsf     PCLATH,3
0015   2???           00071                 goto    RCINT
                      00072 
                      00073 ;***************************************************************************
                      00074 ; Restore the values that were in the W, STATUS, PCLATH, and FSR
                      00075 ; registers just after the interrupt was called.
                      00076 ;
                      00077 ; These values were saved in the routine at the beginning of the
                      00078 ; program at "org 4 ; Interrupt vector"
                      00079 
0016                  00080 END_ISR:
0016   1683           00081                 bsf     STATUS,RP0
0017   087E           00082                 movf    PCLATH_TEMP,W
0018   008A           00083                 movwf   PCLATH
0019   087D           00084                 movf    FSR_TEMP,W
001A   0084           00085                 movwf   FSR
001B   0E7C           00086                 swapf   STATUS_TEMP,W
001C   0083           00087                 movwf   STATUS
001D   0EFF           00088                 swapf   W_TEMP,F
001E   0E7F           00089                 swapf   W_TEMP,W
                      00090 
001F   0009           00091                 retfie                          ; return from interrupt
                      00092 ;*******************************************************************************************************
                            ***
                      00093 ;宏定义
                      00094 I2C_WR_SUB      MACRO   _BYTES_, _SourcePointer_, _Sub_Address_
                      00095 
                      00096                 movlw   _BYTES_
                      00097                 movwf   BYTES
                      00098                 movlw   _SourcePointer_
                      00099                 movwf   SourcePointer
                      00100                 movlw   _Sub_Address_
                      00101                 movwf   SubAddress
                      00102                 call    W24C02
                      00103 
                      00104                 ENDM
                      00105 
                      00106 I2C_READ_SUB    MACRO   _BYTES_, _DestPointer_, _SubAddress_
                      00107 
                      00108 
                      00109 
                      00110                 movlw   _BYTES_
                      00111                 movwf   BYTES
                      00112                 movlw   _DestPointer_
                      00113                 movwf   DestPointer
                      00114                 movlw   _SubAddress_
                      00115                 movwf   SubAddress
                      00116                 call    R24C02
                      00117 
                      00118                 ENDM
                      00119 
                      00120 ;************************************************************************
                      00121 ; Program start
                      00122 
                      00123 ;************************************************************************
                      00124 
0020                  00125 Start:
0020   148E           00126                 bsf     PCON,NOT_POR            ; must be set in software after a Power-on Reset occurs
0021                  00127 MCLR_RESET:
0021   1283           00128                 bcf     STATUS,RP0              ; Bank 0
0022   0064           00129                 clrwdt
0023   018A           00130                 clrf    PCLATH                  ; Prog page 0
0024   1683           00131                 bsf     STATUS,RP0              ; bank 1
0025   1206           00132                 bcf     RST7756_TRIS            ; MOT re_set to output
0026   1283           00133                 bcf     STATUS,RP0              ; bank 0
0027   1206           00134                 bcf     RST7756
0028   2???           00135                 call    PowerOnDelay            ; all delay 180ms
                      00136 
0029   158A           00137                 bsf     PCLATH,3
002A   2???           00138                 call    InitPeriph              ; initialize controller peripherals and some variables
002B   118A           00139                 bcf     PCLATH,3
                      00140 
002C   2???           00141                 call    InitValues              ; get default values from the EEPROM,
                      00142                                                 ; place them in variables and write to CS5460,
002D   158A           00143                 bsf     PCLATH,3
002E   2???           00144                 call    ConfigInt               ; initialize interrupts
002F   118A           00145                 bcf     PCLATH,3
                      00146 
0030   2???           00147                 goto    MainLoop
                      00148 
                      00149 ;***************************************************************************
0031                  00150 InitValues:                                     ; Read EEPROM default values
0031   083A           00151                 movf    PWRUP55,W               ; get byte from RAM
0032   3C55           00152                 sublw   0x55                    ; compare with expected value
0033   1D03           00153                 btfss   STATUS,Z                ; was there a match?
0034   2???           00154                 goto    START3                  ; no, was cold start.
0035   083B           00155                 movf    PWRUPAA,W               ; yes, might be a warm start.
0036   3CAA           00156                 sublw   0xAA                    ; if PWRUPAA <> 0xAA and PWRUP55
0037   1D03           00157                 btfss   STATUS,Z                ; <> 0x55 then this was a cold start
0038   2???           00158                 goto    START3                  ; no, was cold start.
                      00159 ; 热复位:恢复灯
0039   1C31           00160                 btfss   Charging
003A   2???           00161                 goto    IV3
003B   1506           00162                 bsf     RedLed          ; on 
003C   1105           00163                 bcf     CH
003D   2???           00164                 goto    START6                  
003E                  00165 IV3:            
003E   1CB1           00166                 btfss   disCharging
003F   2???           00167                 goto    IV4                     
0040   1586           00168                 bsf     GreenLed        ; on 
0041   1185           00169                 bcf     DISCH
0042   2???           00170                 goto    START6                  
0043                  00171 IV4:
0043   1F32           00172                 btfss   BattOn
0044   2???           00173                 goto    START6                  
0045   1506           00174                 bsf     RedLed          ;有电池亮桔灯
0046   1586           00175                 bsf     GreenLed        
0047   2???           00176                 goto    START6                  
                      00177 
0048                  00178 START3:
0048   158A           00179                 bsf     PCLATH,3
0049   2???           00180                 call    ClearRAM
004A   118A           00181                 bcf     PCLATH,3
004B   0064           00182                 clrwdt
004C   30AA           00183                 movlw   0xAA                    ; Write 0xAA to PWRUPAA
004D   00BB           00184                 movwf   PWRUPAA
004E   3055           00185                 movlw   0x55                    ; Write 0x55 to PWRUP55
004F   00BA           00186                 movwf   PWRUP55
                      00187 
0050                  00188 START6:
                      00189 ; 预设参数上电读出
                      00190 
                      00191                 I2C_READ_SUB    0x03, BFIIC, AT_Current
                          M 
                          M 
                          M 
0050   3003               M                 movlw   0x03
0051   00A8               M                 movwf   BYTES
0052   3020               M                 movlw   BFIIC
0053   00AA               M                 movwf   DestPointer
0054   3030               M                 movlw   AT_Current
0055   00AB               M                 movwf   SubAddress
0056   2???               M                 call    R24C02
                          M 
0057   3020           00192                 movlw   BFIIC
0058   00AF           00193                 movwf   I
0059   30A0           00194                 movlw   Current_LOW
005A   00F7           00195                 movwf   J
005B   3003           00196                 movlw   D'3'
005C   00AE           00197                 movwf   tempCount
005D   2???           00198                 call    S0_S1
                      00199 
                      00200 ; -------------------------------------------------------------
                      00201                 I2C_READ_SUB    0x03, BFIIC, AT_ConstantV
                          M 

⌨️ 快捷键说明

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