sm59d04g2 SyncMOS Technologies,Inc, sm59d04g2 Datasheet - Page 38

no-image

sm59d04g2

Manufacturer Part Number
sm59d04g2
Description
8-bits Micro-controller 16kb+ Isp Flash & 1kb Ram Embedded
Manufacturer
SyncMOS Technologies,Inc
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
sm59d04g2C25JP
0
10.4 Using Timer 2 to Generate Baud Rates.
In the SM59D04G2, Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in
T2CON. Note then the baud rates for transmit and receive can be simultaneously different. Setting
RCLK and/or TCLK puts Timer 2 into its baud rate generator mode.
The baud rate generator mode is similar to the auto-reload mode, in that a rollover in TH2 causes
the Timer 2 registers to be reloaded with the 16-bit value in registers RCAP2H and RCAP2L, which
are preset by software.
Now, the baud rates in Modes1 and 3 are determined by Timer 2’s overflow rate as follows:
Modes 1, 3
The timer can be configured for either “timer” or “counter” operation. In the most typical applications,
it is configured for “timer” operation (C/T2 = 0). “Timer” operation is a little different for Timer 2 when
it’s being used as a baud rate generator. Normally, as a timer, it would increment every machine
cycle (thus at 12 oscillator cycles in 12T, or 6 cycles in 6T). As a baud rate generator however, it
increments in every system frequency. In that case, the baud rate is given by the formula
Modes 1, 3
Where (RCAP2H, RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16-bit unsigned
integer.
Timer 2 as a baud rate generator is shown in Figure 10-1. This Figure is valid only if RCLK + TCLK
= 1 in T2CON. Note that a rollover in TH2 does not set TF2, and will not generate an interrupt.
Therefore, a Timer 2 interrupt does not have to be disabled when Timer 2 is in the baud rate
generator mode. Please also note that if EXEN2 is set, a 1-to-0 transition in T2EX will set EXF2 but
will not cause a reload from (RCAP2H, RCAP2L) to (TH2, TL2). Thus when Timer 2 is in use as a
baud rate generator, T2EX can be used as an extra external interrupt, if desired.
We should keep mind that when Timer 2 is running (TR2 = 1) in “timer” function in the baud rate
generator mode, one should not try to read or write TH2 or TL2. Under these conditions the timer is
being incremented every state time, and the results of a read or write may not be accurate. The
RCAP registers may be read, but shouldn’t be written to, because a write might overlap a reload and
cause write and/or reload errors. In this case, turn the timer off (clear TR2) before accessing the
Timer 2 or RCAP registers.
Specifications subject to change without notice contact your sales representatives for the most recent information.
ISSFD-M031
Baud Rate =
Baud Rate =
6 1
Timer
×
[65536
2
overflow
System
16
-
(RCAP2H,
Frequency
rate
38
RCAP2L)]
16KB+ ISP Flash & 1KB RAM embedded
Ver.C SM59D04G2 07/2009
8-Bits Micro-controller
SM59D04G2

Related parts for sm59d04g2