ORG
010H
;bank0 variables
clock
EQU
$
;clock bank
buttons
EQU $ ;push button bank
;
time_base_lo
DS
1
;time base delay (low byte)
time_base_hi
DS
1
;time base delay (high byte)
msec_lo
DS
1
;millisecond count (low)
msec_hi
DS
1
;millisecond count (high)
IF
clock_type>0
;do we want sec, min, hours?
seconds
DS
1
;seconds count
minutes
DS
1
;minutes count
hours
DS
1
;hours count
ENDIF
IF
clock_type>1
;do we want day count?
days
DS
1
;days count
ENDIF
;
;
debounce0
DS
1
;push button 0 debounce count
debounce1
DS
1
;push button 1 debounce count
debounce2
DS
1
;push button 2 debounce count
debounce3
DS
1
;push button 3 debounce count
pbflags
DS
1
;push button status flags
pb0_pressed
EQU
pbflags.0
;push button 0 action status
pb1_pressed
EQU
pbflags.1
;push button 1 action status
pb2_pressed
EQU
pbflags.2
;push button 2 action status
pb3_pressed
EQU
pbflags.3
;push button 3 action status
pb0_down
EQU
pbflags.4
;push button 0 down status
pb1_down
EQU
pbflags.5
;push button 1 down status
pb2_down
EQU
pbflags.6
;push button 2 down status
pb3_down
EQU
pbflags.7
;push button 3 down status
;
;*************************** INTERRUPT VECTOR ******************************
;
; Note: The interrupt code must always originate at 0h.
;
A jump vector is not needed if there is no program data that needs
;
to be accessed by the IREAD instruction, or if it can all fit into
;
the lower half of page 0 with the interrupt routine.
;
ORG 0
;interrupt always at 0h
;
JMP
interrupt
;interrupt vector
;
;**************************** INTERRUPT CODE *******************************
;
; Note: Care should be taken to see that any very timing sensitive routines
; (such as adcs, etc.) are placed before other peripherals or code
; which may have varying execution rates (like the software clock, for
;
example).
;
interrupt
;beginning of interrupt code
;
;****** Virtual Peripheral: Time Clock
;
; This routine maintains a real-time clock count (in msec) and allows processing
; of routines which only need to be run once every millisecond.
;
;
Input variable(s) : time_base_lo,time_base_hi,msec_lo,msec_hi
;
seconds, minutes, hours, days
;
Output variable(s) : msec_lo,msec_hi
;
seconds, minutes, hours, days
;
Variable(s) affected : time_base_lo,time_base_hi,msec_lo,msec_hi
;
seconds, minutes, hours, days
;
Flag(s) affected :
;
Size : 17/39/45 bytes (depending upon clock type)
;
+ 1 if bank select needed