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

📄 genericreset.asm

📁 Alarm clock with PIC microcontroller
💻 ASM
字号:
;==============================================================================
; Reset Vector
;------------------------------------------------------------------------------

; Notes
;
; This module provides a generic handler for resets. It checks the state of the
; STATUS register and special function registers (if available) to determine
; the reason for the reset and executes an appropriate handler (definable in
; the user application).
;
; Some portions of the code are adjusted if the device does not have a paged
; code area to produce less instructions.

;==============================================================================
; Revision History:
;
; 2004-12-27 AJ Initial version
;------------------------------------------------------------------------------

                include ../pic.inc

                errorlevel -302
                errorlevel -312

                global  Reset

                extern  PowerOnReset
                extern  WatchDogReset
                extern  MCLRReset

                if      HAS_BO_DETECT
                extern  BrownOutReset
                endif

;==============================================================================

                code

; Test /TO bit to see if a timeout generated the reset

Reset:
                btfss   STATUS,NOT_TO
                if      HAS_BANKED_ROM
                goto    Timeout
                else
                goto    WatchDogReset
                endif

; If /TO = 1 then examine /PD to differentiate between POR (or BOR) and MCLR.

                btfss   STATUS,NOT_PD
                if      HAS_BANKED_ROM
                goto    MCLR
                else
                goto    MCLRReset
                endif

; If /TO = 1 and /PD = 1 then POR or BOR has occurred (if the PIC supports its
; detection).

                if      HAS_BO_DETECT
                banksel PCON
                btfsc   PCON,NOT_POR
                 if      HAS_BANKED_ROM
                goto    BrownOut
                lgoto   PowerOnReset
BrownOut:
                lgoto   BrownOutReset
                 else
                goto    BrownOutReset
                goto    PowerOnReset
                 endif
                else
                lgoto   PowerOnReset
                endif

; If /TO = 1 and /PD = 0 the the MCLR pin has been used to reset the device.

MCLR:
                if      HAS_BANKED_ROM
                lgoto   MCLRReset
                else
                goto    MCLRReset
                endif

; If /TO = 0 then the watch dog timer is enabled and has triggered an reset.

Timeout:
                if      HAS_BANKED_ROM
                lgoto   WatchDogReset
                else
                goto    WatchDogReset
                endif

                end

⌨️ 快捷键说明

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