EasyManuals Logo

Holtek HT48R30A-1 User Manual

Default Icon
174 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #59 background imageLoading...
Page #59 background image
Prescaler
The single timer in the HT48R10A-1/HT48C10-1 and HT48R30A-1/HT48C30-1, Timer/Event
Counter 0 in the HT48R50A-1/HT48C50-1 as well as Timer/Event Counter 2 in the HT48RU80/
HT48CU80 all possess a prescaler. Bits 0~2 of their associated timer control register, namely bits
PSC0~PSC2, T0PSC0~T0PSC2 or T2PSC0~T2PSC2, define the pre-scaling stages of the inter
-
nal clock source of the Timer/Event Counter. The Timer/Event Counter overflow signal can be
used to generate signals for the PFD and as a Timer interrupt.
I/O Interfacing
The Timer/Event Counter when configured to run in the event counter or pulse width measure
-
ment mode, require the use of the external timer pin for correct operation. This external timer pin
may be pin-shared with other I/O pins, depending upon which device is selected. For pin-shared
timer pins, pull-high resistors can be selected for connection to the timer input pins. The timers can
also be setup to drive the pin-shared buzzer pins. When the buzzer pins are selected by selecting
the correct configuration option, the output of the chosen timer can be made to drive this at a fre
-
quency determined by the contents of the timer register and where appropriate the timer.
Programming Considerations
When configured to run in the timer mode, the internal system clock or RTC is used as the timer
clock source and is therefore synchronized with the overall operation of the microcontroller. In this
mode, when the appropriate timer register is full, the microcontroller will generate an internal inter
-
rupt signal directing the program flow to the respective internal interrupt vector. For the pulse width
measurement mode, the internal system clock or RTC is also used as the timer clock source but
the timer will only run when the correct logic condition appears on the external timer input pin. As
this is an external event and not synchronized with the internal timer clock, the microcontroller will
only see this external event when the next timer clock pulse arrives. As a result there may be small
differences in measured values requiring programmers to take this into account during program-
ming. The same applies if the timer is configured to be in the event counting mode which again is
an external event and not synchronized with the internal system or timer clock.
Timer Program Example
The following example program section is based on the HT48R50A-1/HT48C50-1 devices, which
contain one internal 8-bit Timer/Event Counter and one internal 16-bit Timer/Event Counter. Pro
-
gramming the Timer/Event Counters for other devices is conducted in a very similar way. The pro
-
gram shows how the Timer/Event Counter registers are setup along with how the interrupts are
enabled and managed. Points to note in the example are how, for the 16-bit Timer/Event Coun
-
ters, the low byte must be written first, this is because the 16-bit data will only be written into the ac
-
tual timer register when the high byte is loaded. Also note how the Timer/Event Counter is turned
on, by setting bit 4 of the respective timer control register. The Timer/Event Counter can be turned
off in a similar way by clearing the same bit. This example program sets the Timer/Event Counters
to be in the timer mode, which uses the internal system clock as their clock source. The
Timer/Event Counter clock sources are setup via configuration options.
50
I/O Type MCU

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Holtek HT48R30A-1 and is the answer not in the manual?

Holtek HT48R30A-1 Specifications

General IconGeneral
BrandHoltek
ModelHT48R30A-1
CategoryMicrocontrollers
LanguageEnglish

Related product manuals