ADE5166_08 AD [Analog Devices], ADE5166_08 Datasheet - Page 129
ADE5166_08
Manufacturer Part Number
ADE5166_08
Description
Single-Phase Energy Measurement IC with 8052 MCU, RTC, and LCD Driver
Manufacturer
AD [Analog Devices]
Datasheet
1.ADE5166_08.pdf
(148 pages)
- Current page: 129 of 148
- Download datasheet (3Mb)
UART2 OPERATION MODE
The UART2 has two operation modes where each data byte
(LSB first) is preceded by a start bit (0), followed by a stop bit
(1). Therefore, each frame consists of 10 bits transmitted on the
TxD2 pin or received on the RxD2 pin.
The baud rate is set by a dedicated timer for baud rate genera-
tion, the UART2 timer, which has a fractional divisor to precisely
generate any baud rate.
Transmission is initiated by a write to the Serial Port 2 SFR
(SBUF2, Address 0xEB). Next, a stop bit (1) is loaded into the
ninth bit position of the serial port shift register. The data is output
bit by bit until the stop bit appears on the TxD2 pin and the
Serial Port 2 transmit interrupt flag, TI2 (Bit 1 of the SCON2
SFR) is automatically set, as shown in Figure 105.
(SCON2[1])
Reception is initiated when a 1-to-0 transition is detected on
the RxD2 pin. Assuming that a valid start bit is detected, char-
acter reception continues. The eight data bits are clocked into
the serial port shift register.
All of the following conditions must be met at the time the final
shift pulse is generated to receive a character:
•
•
If any of these conditions is not met, the received frame is
irretrievably lost, and the Serial Port 2 receive interrupt flag,
RI2, is not set.
If the received frame meets the preceding conditions, the fol-
lowing events occur:
•
•
Transmission is initiated by any instruction that uses SBUF2 as
a destination register. Reception is initiated by the incoming start
bit if REN2 = 1 in the SCON2 SFR, Address0xE1[2].
TxD2
If the extended UART is disabled (EXTEN = 0 in the CFG
SFR), RI (Bit 0 in the SCON SFR) must be 0 to receive a
character. This ensures that the data in the SBUF SFR is not
overwritten if the last received character has not been read.
If frame error checking is enabled by setting SM2 (Bit 5 in
the SCON SFR), the received stop bit must be set to receive
a character. This ensures that every character received comes
from a valid frame, with both a start bit and a stop bit.
The eight bits in the receive shift register are latched into
SBUF2.
The Serial Port 2 receiver interrupt flag (RI2) is set.
TI2
START
BIT
Figure 105. 8-Bit Variable Baud Rate
D0
D1
D2
D3
D4
D5
READY FOR MORE DATA)
D6
(FOR EXAMPLE,
SET INTERRUPT
D7
STOP BIT
Rev. 0 | Page 129 of 148
9-Bit UART 2 with Variable Baud Rate
Setting EN-T8 in the serial communications control SFR (SCON2,
Address 0xE1[6]) selects the 9-bit mode. In this mode, the UART2
serial port operates in 9-bit mode with a variable baud rate. The
baud rate is set by a dedicated timer for baud rate generation,
the UART2 timer, which has a fractional divisor to precisely
generate any baud rate (see the UART Timer Generated Baud Rates
section). The operation of the 9-bit UART2 is the same as for
the 9-bit mode of the UART.
In both modes, transmission is initiated by any instruction that
uses SBUF2 as a destination register. Reception is initiated in
8-bit mode when RI = 0 and REN = 1 in the SCON SFR. Recep-
tion is initiated in the 9-bit mode by the incoming start bit if
REN = 1.
UART2 BAUD RATE GENERATION
The baud rate is determined by the overflow rate of the dedicated
baud rate generator, the UART2 timer, which has an integer and
fractional divisor.
UART2 Timer Generated Baud Rates
The enhanced Serial Baud Rate Control 2 SFR (SBAUD2,
Address 0xEE) is used to control the UART2 timer. SBAUD2 is
the baud rate control SFR; it sets up the integer divider (DIV2)
and the extended divider (SBTH2) for the UART2 timer.
The desired value to write to DIV2 (Bits[2:0]) and to SBTH2
(Bits[4:3]) can be calculated using the following formula, where
f
must be rounded down to the nearest integer.
SBAUDF2 is the fractional divider ratio required to achieve the
required baud rate. The appropriate value for SBAUDF2 can be
calculated with the following formula:
Note that the SBAUDF2 can only take two values, 0x87 or 0xAB,
by clearing or by setting the SBF2 bit (Bit 5), respectively, in the
SBAUD2 SFR. These values were chosen to provide an accurate
baud rate for 300, 2400, 4800, 9600, 19,200, 38,400, 57,600, and
115,200 bps. Once DIV2 and SBAUDF2 are calculated, the actual
baud rate can be calculated, using the following formula:
core
is defined in the POWCON SFR. Note that the DIV2 value
DIV2 + SBTH2 =
SBAUDF2 =
Actual Baud Rate =
64
×
⎛
⎜
⎜
⎝
16
log
16
×
⎛
⎜
⎜
⎝
2
16
×
DIV
2
×
log
2
DIV
+
Baud
SBTH
f
( )
f
2
ADE5166/ADE5169
core
2
core
+
2
SBTH
×
Rate
Baud
2
f
×
core
⎞
⎟
⎟
⎠
⎛ +
⎜
⎝
Rate
1
SBAUDF
−
1
⎞
⎟
⎟
⎠
64
2
⎞
⎟
⎠
Related parts for ADE5166_08
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
DPG2 EVAL ADAPTER FOR XILINX BOARDS
Manufacturer:
Analog Devices Inc
Part Number:
Description:
Xilinx FMC Interface
Manufacturer:
Analog Devices Inc
Datasheet:
Part Number:
Description:
Xilinx FMC Interface
Manufacturer:
Analog Devices Inc
Datasheet:
Part Number:
Description:
Xilinx FMC Interface
Manufacturer:
Analog Devices Inc
Datasheet:
Part Number:
Description:
Xilinx FMC Interface
Manufacturer:
Analog Devices Inc
Datasheet:
Part Number:
Description:
Xilinx FMC Interface
Manufacturer:
Analog Devices Inc
Datasheet:
Part Number:
Description:
Xilinx FMC Interface
Manufacturer:
Analog Devices Inc
Datasheet:
Part Number:
Description:
Xilinx FMC Interface
Manufacturer:
Analog Devices Inc
Datasheet:
Part Number:
Description:
RF Development Tools Sransceiver board for FMC evaluation kit
Manufacturer:
Analog Devices
Part Number:
Description:
Analog Devices: Data Converters: DAC 12-Bit, 10 ns to 100 ns Converters Selection Table
Manufacturer:
AD [Analog Devices]
Datasheet:
Part Number:
Description:
Analog Devices: Data Converters: DAC 8-Bit, 10 ns to 100 ns Converters Selection Table
Manufacturer:
AD [Analog Devices]
Datasheet:
Part Number:
Description:
Low-Power Analog Front End with DSP Microcomputer
Manufacturer:
AD [Analog Devices]
Datasheet:
Part Number:
Description:
2 Pair/1 Pair ETSI Compatible HDSL Analog Front End
Manufacturer:
AD [Analog Devices]
Datasheet: