C h a p t e r 1 6
Interrupt and Timer/Counter
Applications
There are many different methods of using a timer/counter method to
implement an interrupt. For example, if it is required to have a timed signal,
or after a fixed or non-fixed period of time to have an event occur, the timer
counter can be used. During the specified time or count period, the main
program can continue with other functions, when the time or count period
is over an interrupt will be activated. This interrupt can then be used to
run special interrupt code or trigger other special functions. When the
interrupt function ends the code returns to running the main program.
The Holtek HT48X00 microcontroller series timer/counter possess either
16 bit or 8 bit counters. All are count up types. The values are first
converted into 2’s complement and then the 16 or 8 bit value loaded into the
timer/counter. Additionally the timer/counters can be divided up into three
types, event counter, timer or pulse width measurement type. The event
counter type receives generated signals from outside while the timer type
uses the internal system clock as its base timing.
Electronic Piano
This unit describes how to implement a scanning keyboard and then from
the pressed key generate a corresponding defined sound frequency. Each
time a key is pressed the corresponding frequency value is placed into the
timer/counter register. When this counter counts to its maximum value an
internal interrupt is generated and the interrupt routine is run. At this
point the timer/counter register value is reloaded and the counting contin-
ues. In this way, by programming different values into the timer/counter
register, different values of frequency can be generated. The internal
interrupt routine contains code to change the state of the output port and
16
Chapter 16 Interrupt and timer applications
209
Содержание HT-IDE
Страница 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...
Страница 12: ...HT IDE User s Guide 2 ...
Страница 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...
Страница 24: ...HT IDE User s Guide 14 ...
Страница 70: ...HT IDE User s Guide 60 ...
Страница 76: ...HT IDE User s Guide 66 ...
Страница 92: ...HT IDE User s Guide 82 ...
Страница 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...
Страница 94: ...HT IDE User s Guide 84 ...
Страница 148: ...HT IDE User s Guide 138 ...
Страница 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...
Страница 154: ...HT IDE User s Guide 144 ...
Страница 192: ...HT IDE User s Guide 182 ...
Страница 194: ...HT IDE User s Guide 184 ...
Страница 218: ...HT IDE User s Guide 208 ...
Страница 235: ...P a r t V Appendix Part V Appendix 225 ...
Страница 236: ...HT IDE User s Guide 226 ...
Страница 250: ...HT IDE User s Guide 240 ...