This application depends upon the system clock frequency as a basis for its
timing. The application shown here uses a 400kHz system clock which will
generate a 100kHz timer/counter clock due to the internal divide by four
operation. With a 16 bit counter the maximum count is 65536, this would
generate an internal interrupt every 0.65536 seconds. However for a clock
function a basic time unit of 1 second is required so for this reason the
timer/counter is setup to record a basic timing of 0.5 seconds. In this case
an interrupt will be generated every 0.5 seconds, so by counting two
interrupts a means of obtaining the basic timing unit of 1 second is
obtained. The application shown uses 4 seven segment displays to display
a clock in 24 hour format, displaying both hours and minutes. Two keys are
provided to provide for adjustment of hours and minutes.
Circuit design
PA0~PA7 are setup as outputs with PA0~PA3 setup as the display data.
PA4~PA7 provide scanning inputs to the control transistors for the segment
displays. These will scan the individual displays one after the other. PB0
and PB1 are setup as inputs for the switches which enable the hours and
minutes to be preset.
Program
#include ht48c50.inc
;------------------------------------------------------------
data .section ’data’
;== data section ==
Chapter 16 Interrupt and timer applications
213
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 ...