;**If the button activity is short (a few bytes), it can fit here, though be
; careful that longest possible interrupt doesn't exceed int_period # of cycles.
;
; <short code segment can go here>
;
;**Otherwise, use this flag to process button press in main code (and don't
; forget to reset the flag once the button activity is complete).
SETB
pb1_pressed
; and set pb1 action flag
SKIP
;skip next instruction
:pb1_up
CLRB
pb1_down
;button up, clear flag
CLR
debounce1
; and clear debounce count
:done_pb1
;
JMP
done_pbs
;this needed only if path switch used
ENDIF
;more than 1 push button
pb2
IF
num_buttons>2
;more than 2 push buttons?
;
BANK
buttons
;do bank select (if not done elsewhere)
JB
button2,:pb2_up
;button2 pressed?
JB
pb2_down,:done_pb2
;yes, but is it new press?
INC
debounce2
; and adjust debounce count
JNB
debounce2.hold_bit,:done_pb2
;wait till long enough
SETB
pb2_down
;yes, flag that button is down
;**If the button activity is short (a few bytes), it can fit here, though be
; careful that longest possible interrupt doesn't exceed int_period # of cycles.
;
;**Otherwise, use this flag to process button press in main code (and don't
; orget to reset the flag once the button activity is complete).
SETB
pb2_pressed
; and set pb2 action flag
SKIP
;skip next instruction
:pb2_up
CLRB
pb2_down
;button up, clear flag
CLR
debounce2
; and clear debounce count
:done_pb2
;
JMP
done_pbs
;this needed only if path switch used
ENDIF
;more than 2 push buttons
pb3
IF
num_buttons>2
;more than 3 push buttons?
;
BANK
buttons
;do bank select (if not done elsewhere)
JB
button3,:pb3_up
;button3 pressed?
JB
pb3_down,:done_pb3
;yes, but is it new press?
INC
debounce3
; and adjust debounce count
JNB
debounce3.hold_bit,:done_pb3
;wait till long enough
SETB
pb3_down
;yes, flag that button is down
;**If the button activity is short (a few bytes), it can fit here, though be
; careful that longest possible interrupt doesn't exceed int_period # of cycles.
;
;**Otherwise, use this flag to process button press in main code (and don't
; forget to reset the flag once the button activity is complete).
SETB
pb3_pressed
; and set pb3 action flag
SKIP
;skip next instruction
:pb3_up
CLRB
pb3_down
;button up, clear flag
CLR
debounce3
; and clear debounce count
:done_pb3
ENDIF
;more than 3 push buttons
;
done_pbs
;