English
Language : 

ATMEGA128RFA1_11 Datasheet, PDF (349/560 Pages) ATMEL Corporation – 8-bit Microcontroller with Low Power 2.4GHz Transceiver for ZigBee and IEEE 802.15.4
ATmega128RFA1
23.6.4 Parity Generator
The parity generator calculates the parity bit for the serial frame data. When parity bit is
enabled (UPMn1 = 1), the transmitter control logic inserts the parity bit between the last
data bit and the first stop bit of the frame that is sent.
23.6.5 Disabling the Transmitter
The disabling of the transmitter (setting the TXEN to zero) will not become effective until
ongoing and pending transmissions are completed, i.e., when the transmit shift register
and transmit buffer register do not contain data to be transmitted. The transmitter will no
longer override the TxDn pin when disabled.
23.7 Data Reception – The USART Receiver
The USART receiver is enabled by writing the Receive Enable (RXENn) bit in the
UCSRnB register to one. When the receiver is enabled, the normal pin operation of the
RxDn pin is overridden by the USART and given the function as the receiver’s serial
input. The baud rate, mode of operation and frame format must be set up once before
any serial reception can be done. If synchronous operation is used, the clock on the
XCKn pin will be used as transfer clock.
23.7.1 Receiving Frames with 5 to 8 Data Bits
The receiver starts data reception when it detects a valid start bit. Each bit that follows
the start bit will be sampled at the baud rate or XCKn clock, and shifted into the receive
shift register until the first stop bit of a frame is received. A second stop bit will be
ignored by the receiver. When the first stop bit is received, i.e., a complete serial frame
is present in the receive shift register, the contents of the shift register will be moved
into the receive buffer. The receive buffer can then be read by reading the UDRn I/O
location.
The following code example shows a simple USART receive function based on polling
of the Receive Complete Flag (RXCn). When using frames with less than eight bits the
most significant bits of the data read from the UDRn will be masked to zero. The
USART has to be initialized before the function can be used. The function simply waits
for data to be present in the receive buffer by checking the RXCn flag before reading
the buffer and returning the value.
Assembly Code Example(1)
USART_Receive:
; Wait for data to be received
sbis UCSRnA, RXCn
rjmp USART_Receive
; Get and return received data from buffer
in r16, UDRn
ret
8266C-MCU Wireless-08/11
349