User manual
00066_MCP402XEV.ASM Source Code
© 2005 Microchip Technology Inc. DS51546B-page 34
State4 ; LV Decrement
call InitGPIO ; make GP0/DECR/CS & GP1/INCR/UD outputs, block undesired U/D commands
movlw .1
call LV_Decrement
clrf State
retlw .4
State5 ; Both buttons pressed
movlw .200 ; 200x10mS = 2s
movwf Exit
Loop5_2sec
call GPIO_TestUP ; make GP1/INCR/UD an input (w/pu enabled)
movlw .5 ; 5ms delay
call VAR1000TcyDELAY
btfsc UP ; if UP gets released, exit
retlw .5
call GPIO_TestDOWN ; make GP0/DECR/CS an input (w/pu enabled)
movlw .5 ; 5ms delay
call VAR1000TcyDELAY
btfsc DOWN ; if DOWN gets released, exit
retlw .5
decfsz Exit,f
goto Loop5_2sec
call InitGPIO ; make GP0/DECR/CS & GP1/INCR/UD outputs, block undesired U/D commands
movlw .64
call HV_Increment_WL_Disable
; movlw .4
; call VAR1000TcyDELAY ; add a 4mS delay for E/W cycle
HV_IncrExit clrwdt
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_IncrExit
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_IncrExit
clrf State
retlw .5
State6
movlw .200 ; 200x10mS = 2s
movwf Exit
Loop6_2sec
call GPIO_TestUP ; make GP1/INCR/UD an input (w/pu enabled)
movlw .5 ; 5ms delay
call VAR1000TcyDELAY
btfsc UP ; if UP gets released, exit
retlw .6
call GPIO_TestDOWN ; make GP0/DECR/CS an input (w/pu enabled)
movlw .5 ; 5ms delay
call VAR1000TcyDELAY
btfsc DOWN ; if DOWN gets released, exit
retlw .6
decfsz Exit,f
goto Loop6_2sec
call InitGPIO ; make GP0/DECR/CS & GP1/INCR/UD outputs, block undesired U/D commands
movlw .64
call HV_Decrement_WL_Disable
; movlw .4
; call VAR1000TcyDELAY ; add a 4mS delay for E/W cycle
TABLE E-1: 00066_MCP402XEV.ASM SOURCE CODE (CONTINUED)