User manual
00066_MCP402XEV.ASM Source Code
© 2005 Microchip Technology Inc. DS51546B-page 33
Loop1_2sec
call GPIO_TestDOWN ; make GP0/DECR/CS an input (w/pu enabled)
movlw .5 ; 5ms delay
call VAR1000TcyDELAY
btfss DOWN ; if DOWN gets pressed, exit
retlw .1
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 .1
decfsz Exit,f
goto Loop1_2sec
call InitGPIO ; make GP0/DECR/CS & GP1/INCR/UD outputs, block undesired U/D commands
movlw .64
call LV_Increment
; movlw .4
; call VAR1000TcyDELAY ; add a 4mS delay for E/W cycle
call GPIO_TestUP ; make GP1/INCR/UD an input (w/pu enabled)
LV_IncrExit
clrwdt
btfss UP ; if UP gets released, exit
goto LV_IncrExit
clrf State
retlw .1
State2 ; DOWN button pressed
movlw .200 ; 200x10mS = 2s
movwf Exit
Loop2_2sec
call GPIO_TestUP ; make GP1/INCR/UD an input (w/pu enabled)
movlw .5 ; 5ms delay
call VAR1000TcyDELAY
btfss UP ; if UP gets pressed, exit
retlw .2
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 .2
decfsz Exit,f
goto Loop2_2sec
call InitGPIO ; make GP0/DECR/CS & GP1/INCR/UD outputs, block undesired U/D commands
undesired U/D commands
movlw .64
call LV_Decrement
; movlw .4
; call VAR1000TcyDELAY ; add a 4mS delay for E/W cycle
call GPIO_TestDOWN ; make GP0/DECR/CS an input (w/pu enabled)
LV_DecrExit
clrwdt
btfss DOWN ; if DOWN gets released, exit
goto LV_DecrExit
clrf State
retlw .2
State3 ; LV Increment
call InitGPIO ; make GP0/DECR/CS & GP1/INCR/UD outputs, block undesired U/D commands
movlw .1
call LV_Increment
clrf State
retlw .3
TABLE E-1: 00066_MCP402XEV.ASM SOURCE CODE (CONTINUED)