User manual
00066_MCP402XEV.ASM Source Code
© 2005 Microchip Technology Inc. DS51546B-page 35
HV_DecrExit clrwdt
call GPIO_TestUP ; make GP1/INCR/UD an input (w/pu enabled)
movlw .10
call VAR1000TcyDELAY ; add a 10mS delay for settling time
btfss UP ; if UP gets released, exit
goto HV_DecrExit
call GPIO_TestDOWN ; make GP0/DECR/CS an input (w/pu enabled)
movlw .10
call VAR1000TcyDELAY ; add a 10mS delay for settling time
btfss DOWN ; if DOWN gets released, exit
goto HV_DecrExit
clrf State
retlw .6
State7
State8
State9
State10
State11 ; HV Increment w/o WL
call InitGPIO ; make GP0/DECR/CS & GP1/INCR/UD outputs, block undesired U/D commands
movlw .1
call HV_Increment_WL_Disable
clrf State
retlw .11
State12 ; HV Increment w/o WL
call InitGPIO ; make GP0/DECR/CS & GP1/INCR/UD outputs, block undesired U/D commands
movlw .1
call HV_Decrement_WL_Disable
clrf State
retlw .12
State13 ; HV Decrement w/WL
call InitGPIO ; make GP0/DECR/CS & GP1/INCR/UD outputs, block undesired U/D commands
call HV_Increment_WL_Enable
clrf State
retlw .13
State14 ; HV Decrement w/WL
call InitGPIO ; make GP0/DECR/CS & GP1/INCR/UD outputs, block undesired U/D commands
call HV_Decrement_WL_Enable
clrf State
retlw .14
State15
goto StateMachineReset
;***********************************************************************************************
; Low Power Mode
;***********************************************************************************************
LowPowerMode
movlw b’11111000’ ; make all I/O pins an output
tris GPIO
movlw b’11111111’
movwf GPIO ; output high
movlw b’10011111’ ; disable Wake-Up on Pin Change,
; enable weak pullups for button inputs
; T0CS must be 0 for GP2 TRIS to be active
; set up for 2.3ms WDT
option
sleep ; put into lowest power setting
goto Start ; shouldn’t get here
SUBS CODE
TABLE E-1: 00066_MCP402XEV.ASM SOURCE CODE (CONTINUED)