inc
minl
;minl+1
mov
a,minl
;
sub
a,0ah
;
sz
acc
;if over 10 minutes?
ret
;no. return
clr
minl
;yes. minl=0
inc
minh
; minh=0
mov
a,minh
;
sub
a,06h
;
sz
acc
;if over 60 minutes?
ret
;no. return
clr
minh
;yes. minh=0 (don’t care hour)
ret
;return
inc_min endp
;
end
Program description
The program begins (1) by defining A as outputs, achieved by setting the
control register PAC to 00. With the exception of bit 7, all bits in Port B are
set as inputs, achieved by setting the control register PBC to 7F. The next
stage (2) is to clear various internal locations of the RAM and enable the
interrupt and timer/counter. Following on from this (3) is the program to
display the time and the program to determine if any key has been pressed.
If the time is to be adjusted because a key has been pressed then the
program calls a routine (4) to adjust either the minutes or the hour. A value
of one will be added to either the minute or hour value. If the minute value
has reached 59 the next value will be set to 00 but the hour value will not
be increased. Similarly if the hour value has reached 23 the next value will
be 00 but the minute value will not be changed. If no key has been pressed
the program remains in the program loop to display the time. Because the
program has been setup to provide an interrupt every 0.5 seconds, a 1
minute time interval is generated every 120 interrupts. Each time this
happens the minutes count will be increased by one. During the program
loop to display the time, the program will look at the interrupt count
number to determine if a value of 120 has been reached (6). If so then the
minutes count will be increased by one (7). Every 60 minutes will become
a count of one hour and after 23 hours the hour count will reset to 00 hours.
The information containing the time for the display is placed upon 4 bits of
Port A and the scanning operation on the remaining 4 bits. In this way the
display is only active for a certain period of time, but because the scanning
speed is high the display appears to be showing its data continuously.
HT-IDE User’s Guide
218
Summary of Contents for HT-IDE
Page 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...
Page 12: ...HT IDE User s Guide 2 ...
Page 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...
Page 24: ...HT IDE User s Guide 14 ...
Page 70: ...HT IDE User s Guide 60 ...
Page 76: ...HT IDE User s Guide 66 ...
Page 92: ...HT IDE User s Guide 82 ...
Page 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...
Page 94: ...HT IDE User s Guide 84 ...
Page 148: ...HT IDE User s Guide 138 ...
Page 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...
Page 154: ...HT IDE User s Guide 144 ...
Page 192: ...HT IDE User s Guide 182 ...
Page 194: ...HT IDE User s Guide 184 ...
Page 218: ...HT IDE User s Guide 208 ...
Page 235: ...P a r t V Appendix Part V Appendix 225 ...
Page 236: ...HT IDE User s Guide 226 ...
Page 250: ...HT IDE User s Guide 240 ...