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

📄 canio.lst

📁 带有CAN接口的PIC18系列单片机的CAN BOOTLOADER汇编程序!
💻 LST
📖 第 1 页 / 共 5 页
字号:

                      00227 ; *****************************************************************************
                      00228 _REMAP_INTV_H   CODE    HIGH_INT_VECT
                      00229 ; *****************************************************************************
000208                00230 IntVectHighRemapped
                      00231 ; *****************************************************************************
                      00232 _REMAP_INTV_L   CODE    LOW_INT_VECT
                      00233 ; *****************************************************************************
000218                00234 IntVectLowRemapped
                      00235 
                      00236 
                      00237 
                      00238 ; *****************************************************************************
                      00239 _STARTUP        CODE    0x00
                      00240 ; *****************************************************************************
000000 D???           00241         bra             _CANInit
000002 D???           00242         bra             _StartWrite
                      00243 ; *****************************************************************************
                      00244 _INTV_H         CODE    0x08
                      00245 ; *****************************************************************************
                      00246 #ifdef  NEAR_JUMP
000008 D???           00247         bra             IntVectHighRemapped
                      00248 #else
                      00249         goto    IntVectHighRemapped
                      00250 #endif
                      00251 ; *****************************************************************************
                      00252 _INTV_L         CODE    0x18
                      00253 ; ***************************************************************************** 
                      00254 #ifdef  NEAR_JUMP
000018 D???           00255         bra             IntVectLowRemapped
                      00256 #else
                      00257         goto    IntVectLowRemapped
                      00258 #endif
                      00259 ; ***************************************************************************** 
                      00260 
                      00261 
                      00262 
                      00263 ; *****************************************************************************
                      00264 _CAN_IO_MODULE  CODE
                      00265 ; *****************************************************************************
                      00266 ; Function:     VIOD _StartWrite(WREG _eecon_data)
                      00267 ;
                      00268 ; PreCondition: Nothing
                      00269 ;
                      00270 ; Input:        _eecon_data
                      00271 ;                               
                      00272 ;
                      00273 ; Output:       Nothing. Self write timing started.
                      00274 ;
                      00275 ; Side 
                      00276 ; Effects:              EECON1 is corrupted.
                      00277 ;                               WREG is corrupted.
                      00278 ;
                      00279 ; Stack 
MPASM 03.20.08 Intermediate                         CANIO.ASM   2-3-2003  15:42:14         PAGE  9


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00280 ; Requirements: 1 level.
                      00281 ;
                      00282 ; Overview:     Unlock and start the write or erase sequence to protected
                      00283 ;                               memory. Function will wait until write is finished.
                      00284 ; *****************************************************************************
000000                00285 _StartWrite:
000000 6EA6           00286         movwf   EECON1
                      00287         
000002 A0??           00288         btfss   MODE_WRT_UNLCK                  ; Stop if write locked
000004 0012           00289         return
                      00290                 
000006 0E55           00291         movlw   0x55                                    ; Unlock
000008 6EA7           00292         movwf   EECON2
00000A 0EAA           00293         movlw   0xAA
00000C 6EA7           00294         movwf   EECON2
00000E 82A6           00295         bsf             EECON1, WR                              ; Start the write
000010 0000           00296         nop
                      00297         
000012 B2A6           00298         btfsc   EECON1, WR                              ; Wait (depends on mem type)
000014 D???           00299         bra             $ - 2
000016 0012           00300         return
                      00301 ; *****************************************************************************
                      00302 
                      00303 
                      00304 ; *****************************************************************************
                      00305 ; Function:      _bootChksm _UpdateChksum(WREG _bootChksmL)
                      00306 ;
                      00307 ; PreCondition: Nothing
                      00308 ;
                      00309 ; Input:        _bootChksmL
                      00310 ;                               
                      00311 ;
                      00312 ; Output:       _bootChksm. This is a static 16 bit value stored in the 
                      00313 ;                               Access Bank.
                      00314 ;
                      00315 ; Side 
                      00316 ; Effects:              STATUS register is corrupted.
                      00317 ;
                      00318 ; Stack 
                      00319 ; Requirements: 1 level.
                      00320 ;
                      00321 ; Overview:     This function adds a byte to the current 16 bit checksum 
                      00322 ;                               count. WREG should contain the byte before being called.
                      00323 ;
                      00324 ;                               The _bootChksm value is considered a part of the special 
                      00325 ;                               register set for bootloading. Thus it is not visible.
                      00326 ;***************************************************************************
000018                00327 _UpdateChksum:
000018 26??           00328         addwf   _bootChksmL, F                  ; Keep a checksum
00001A B0D8           00329         btfsc   STATUS, C
00001C 2A??           00330         incf    _bootChksmH, F
00001E 0012           00331         return
                      00332 ; *****************************************************************************
MPASM 03.20.08 Intermediate                         CANIO.ASM   2-3-2003  15:42:14         PAGE 10


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00333 
                      00334 
                      00335 ; *****************************************************************************
                      00336 ; Function:      VOID _CANInit(CAN, BOOT)
                      00337 ;
                      00338 ; PreCondition: Enter only after a reset has occured.
                      00339 ;
                      00340 ; Input:        CAN control information, bootloader control information
                      00341 ;                               
                      00342 ; Output:       None. 
                      00343 ;
                      00344 ; Side 
                      00345 ; Effects:              N/A. Only run imediately after reset.
                      00346 ;
                      00347 ; Stack 
                      00348 ; Requirements: N/A
                      00349 ;
                      00350 ; Overview:     This routine is technically not a function since it will not 
                      00351 ;                               return when called. It has been written in a linear form to 
                      00352 ;                               save space.     Thus 'call' and 'return' instructions are not 
                      00353 ;                               included, but rather they are implied.
                      00354 ;
                      00355 ;                               This routine tests the boot flags to determine if boot mode is 
                      00356 ;                               desired or normal operation is desired. If boot mode then the
                      00357 ;                               routine initializes the CAN module defined by user input. It 
                      00358 ;                               also resets some registers associated to bootloading.
                      00359 ; *****************************************************************************
000020                00360 _CANInit:               
000020 6AA6           00361         clrf    EECON1
000022 68A9           00362         setf    EEADR                                   ; Point to last location of EEDATA
000024 68AA           00363         setf    EEADRH  
000026 80A6           00364         bsf             EECON1, RD                              ; Read the control code
000028 3CA8           00365         incfsz  EEDATA, W
                      00366 #ifdef  NEAR_JUMP
00002A D???           00367         bra             ResetRemapped                           ; If not 0xFF then normal reset
                      00368 #else
                      00369         goto    ResetRemapped
                      00370 #endif
                      00371         
00002C 6A??           00372         clrf    _bootSpcCmd                             ; Reset the special command register
                      00373         
00002E 0E1C           00374         movlw   0x1C                                    ; Reset the boot control bits
000030 6E??           00375         movwf   _bootCtlBits
                      00376                 
000032 010F           00377         movlb   d'15'                                   ; Set Bank 15
                      00378         
000034 9493           00379         bcf             TRISB, CANTX                    ; Set the TX pin to output      
                      00380                 
000036 0E00           00381         movlw   CAN_RXF0SIDH                    ; Set filter 0
000038 6F00           00382         movwf   RXF0SIDH
00003A 0E08           00383         movlw   CAN_RXF0SIDL
00003C 6F01           00384         movwf   RXF0SIDL
00003E 1EE8           00385         comf    WREG                                    ; Prevent filter 1 from causing a
MPASM 03.20.08 Intermediate                         CANIO.ASM   2-3-2003  15:42:14         PAGE 11


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

000040 6F05           00386         movwf   RXF1SIDL                                ; receive event
000042 0E00           00387         movlw   CAN_RXF0EIDH
000044 6F02           00388         movwf   RXF0EIDH
000046 0E07           00389         movlw   CAN_RXF0EIDL
000048 6F03           00390         movwf   RXF0EIDL
                      00391         
00004A 0EFF           00392         movlw   CAN_RXM0SIDH                    ; Set mask
00004C 6F18           00393         movwf   RXM0SIDH
00004E 0EE3           00394         movlw   CAN_RXM0SIDL
000050 6F19           00395         movwf   RXM0SIDL
000052 0EFF           00396         movlw   CAN_RXM0EIDH
000054 6F1A           00397         movwf   RXM0EIDH
000056 0EFC           00398         movlw   CAN_RXM0EIDL
000058 6F1B           00399         movwf   RXM0EIDL
                      00400         
00005A 0EC1           00401         movlw   CAN_BRGCON1                             ; Set bit rate
00005C 6E70           00402         movwf   BRGCON1
00005E 0EBA           00403         movlw   CAN_BRGCON2
000060 6E71           00404         movwf   BRGCON2
000062 0E07           00405         movlw   CAN_BRGCON3
000064 6E72           00406         movwf   BRGCON3
                      00407         
000066 0E20           00408         movlw   CAN_CIOCON                              ; Set IO
000068 6E73           00409         movwf   CIOCON
                      00410                 
00006A 6A6F           00411         clrf    CANCON                                  ; Enter Normal mode
                      00412 ; *****************************************************************************
                      00413         
                      00414         
                      00415         
                      00416         

⌨️ 快捷键说明

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