English
Language : 

VMX51C900 Datasheet, PDF (26/55 Pages) List of Unclassifed Manufacturers – Versa Mix 8051 MCU with LCD Controller and ADC
VMX51C900
The value to write into the TH1 register is defined by
the following formula:
TH1 = 256 -
2SMODx Fosc
32 x 12x (Baud Rate)
Generating UART Baud Rates with Timer 2
Timer 2 is often preferred to generate the baud rate, as
it can be easily configured to operate as a 16-bit timer
with auto-reload. This enables much better resolution
than using Timer 1 in 8-bit auto-reload mode.
The baud rate using Timer 2 is defined as:
Mode 1,3 Baud Rate = Timer 2 Overflow Rate
16
The timer can be configured as either a timer or a
counter in any of its three running modes. In typical
applications, it is configured as a timer (C/T2 is set to
0).
To make the Timer 2 operate as a baud rate generator,
the TCLK and RCLK bits of the T2CON register must
be set to 1.
The baud rate generator mode is similar to the auto-
reload mode in that an overflow 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. However, when Timer 2 is configured as a
baud rate generator, its clock source is Osc/2.
The following formula can be used to calculate the
baud rate in modes 1 and 3 using Timer2:
Modes 1, 3 Baud Rate =
Oscillator Frequency
32x[65536 – (RCAP2H, RCAP2L)]
The formula below is used to define the reload value to
write into the RCAP2h, RCAP2L registers to achieve a
given baud rate.
(RCAP2H, RCAP2L) = 65536 -
Fosc
32x[Baud Rate]
In the above formula, RCAP2H and RCAP2L are the
content of RCAP2H and RCAP2L taken as a 16-bit
unsigned integer.
Note that a rollover in TH2 does not set TF2 and will
not generate an interrupt. Therefore, the Timer 2
interrupt does not have to be disabled when Timer 2 is
configured in baud rate generator mode. Furthermore,
when Timer 2 is operating as a UART baud rate
generator (TR2 is set to 1), the user should not try to
perform read or write operations to the TH2 or TL2 and
RCAP2H, RCAP2L registers.
______________________________________________________________________________________________
www.ramtron.com
page 26 of 55