User manual
00066_MCP402XEV.ASM Source Code
© 2005 Microchip Technology Inc. DS51546B-page 38
;***********************************************************************************************
; Button Isolation Subroutines
;***********************************************************************************************
; Low Voltage Increment & Decrement Subroutines
;***********************************************************************************************
LV_Increment
movwf Exit ; load the loop counter
bsf UD
goto $+1 ; creates a 3us total delay
bcf CS
movlw .100 ; 5*100 = 500us delay to pull down CS
movwf DLYCNT1
DLOOP_LVI
clrwdt ;or NOP
nop
decfsz DLYCNT1,f
goto DLOOP_LVI
LV_IncrLoop
bcf UD
goto $+1
bsf UD
goto $+1 ; creates a 3us total delay
decfsz Exit,f ; Have we incremented the wiper enough?
goto LV_IncrLoop
IFDEF SaveWiper
bcf UD
goto $+1 ; creates a 3us total delay
ENDIF
bsf CS
retlw 0x00 ; Follow w/long delay to ramp CS & EEPROM Write Cycle
LV_Decrement
movwf Exit ; load the loop counter
bcf UD
goto $+1 ; creates a 3us total delay
bcf CS
movlw .100 ; 5*100 = 500us delay to pull down CS
movwf DLYCNT1
DLOOP_LVD
clrwdt ;or NOP
nop
decfsz DLYCNT1,f
goto DLOOP_LVD
IFDEF SaveWiper
goto LV_DecrLoop+4 ; skip first Decrement since final edge is rising
ENDIF
LV_DecrLoop
bsf UD
goto $+1 ; creates a 3us total delay
bcf UD
goto $+1 ; creates a 3us total delay
decfsz Exit,f ; Have we decremented the wiper enough?
goto LV_DecrLoop
IFDEF SaveWiper
bsf UD
goto $+1 ; creates a 3us total delay
ENDIF
bsf CS ; Follow w/long delay to ramp CS & EEPROM Write Cycle
retlw 0x01
TABLE E-1: 00066_MCP402XEV.ASM SOURCE CODE (CONTINUED)