Parity generator, Disabling the transmitter, Data reception – the usart receiver – Rainbow Electronics ATmega162V User Manual

Page 174: Atmega162/v

Advertising
background image

174

ATmega162/V

2513E–AVR–09/03

Empty Interrupt, otherwise a new interrupt will occur once the interrupt routine
terminates.

The Transmit Complete (TXC) Flag bit is set one when the entire frame in the Transmit
Shift Register has been shifted out and there are no new data currently present in the
transmit buffer. The TXC Flag bit is automatically cleared when a transmit complete
interrupt is executed, or it can be cleared by writing a one to its bit location. The TXC
Flag is useful in half-duplex communication interfaces (like the RS-485 standard), where
a transmitting application must enter Receive mode and free the communication bus
immediately after completing the transmission.

When the Transmit Compete Interrupt Enable (TXCIE) bit in UCSRB is set, the USART
Transmit Complete Interrupt will be executed when the TXC Flag becomes set (pro-
vided that global interrupts are enabled). When the transmit complete interrupt is used,
the interrupt handling routine does not have to clear the TXC Flag, this is done automat-
ically when the interrupt is executed.

Parity Generator

The Parity Generator calculates the parity bit for the serial frame data. When parity bit is
enabled (UPM1 = 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.

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. When dis-
abled, the Transmitter will no longer override the TxD pin.

Data Reception – The
USART Receiver

The USART Receiver is enabled by writing the Receive Enable (RXEN) bit in the
UCSRB Register to one. When the receiver is enabled, the normal pin operation of the
RxD 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
XCK pin will be used as transfer clock.

Advertising