Just air code. I'm using timer SFR names
from micros I use, so they may not apply
to the '675:
Button_Loop
btfsc GPIO, 0
goto Button_Loop
; enable 1 second timer here
Short_Loop
btfsc GPIO, 0
goto Short_Press
; loop until timer expires
btfss PIR1, TMR1IF
goto Short_Loop
; if timer manages to expire, the
; button is still pressed,
; and is considered a 'long' (>1sec)
; press.
; turn off timer here
Long_Press ; keep looping until button is released
btfss GPIO, 0
goto Long_Press
; run your 'long press' code
goto Main_Program
Short_Press
; if gpio<0> went high before 1sec,
; the button was released as a 'short'
; (<1sec) press.
; turn off timer here
; run your 'short press' code
goto Main_Program
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
PIC12F629 Comparator | Microcontrollers | 0 | ||
Issue with programming PIC12F629 | Microcontrollers | 23 | ||
Comparator project code for PIC12F629 / 675 in Assembly Language | Microcontrollers | 3 | ||
K | pic12f629 timer problem | Programming & Languages | 21 | |
R | PIC12F629 2.5 minutes delay at start up the first time | Microcontrollers | 4 |