ATmega88PA Automotive Atmel Corporation, ATmega88PA Automotive Datasheet - Page 183
ATmega88PA Automotive
Manufacturer Part Number
ATmega88PA Automotive
Description
Manufacturer
Atmel Corporation
- Current page: 183 of 371
- Download datasheet (12Mb)
20.6
20.6.1
9223B–AVR–09/11
Data Transmission – The USART Transmitter
Sending Frames with 5 to 8 Data Bit
The USART Transmitter is enabled by setting the Transmit Enable (TXEN) bit in the UCSRnB
Register. When the Transmitter is enabled, the normal port operation of the TxDn pin is over-
ridden by the USART and given the function as the Transmitter’s serial output. The baud rate,
mode of operation and frame format must be set up once before doing any transmissions. If
synchronous operation is used, the clock on the XCKn pin will be overridden and used as
transmission clock.
A data transmission is initiated by loading the transmit buffer with the data to be transmitted.
The CPU can load the transmit buffer by writing to the UDRn I/O location. The buffered data in
the transmit buffer will be moved to the Shift Register when the Shift Register is ready to send
a new frame. The Shift Register is loaded with new data if it is in idle state (no ongoing trans-
mission) or immediately after the last stop bit of the previous frame is transmitted. When the
Shift Register is loaded with new data, it will transfer one complete frame at the rate given by
the Baud Register, U2Xn bit or by XCKn depending on mode of operation.
The following code examples show a simple USART transmit function based on polling of the
Data Register Empty (UDREn) Flag. When using frames with less than eight bits, the most
significant bits written to the UDRn are ignored. The USART has to be initialized before the
function can be used. For the assembly code, the data to be sent is assumed to be stored in
Register R16
The function simply waits for the transmit buffer to be empty by checking the UDREn Flag,
before loading it with new data to be transmitted. If the Data Register Empty interrupt is uti-
lized, the interrupt routine writes the data into the buffer.
Assembly Code Example
C Code Example
Note:
Atmel ATmega48PA/88PA/168PA [Preliminary]
USART_Transmit:
void USART_Transmit( unsigned char data )
{
}
; Wait for empty transmit buffer
in r16, UCSRnA
sbrs r16, UDREn
rjmp USART_Transmit
; Put data (r16) into buffer, sends the data
out
ret
/* Wait for empty transmit buffer */
while ( !( UCSRnA & (1<<UDREn)) )
/* Put data into buffer, sends the data */
UDRn = data;
1. See
UDRn,r16
;
Section 6. “About Code Examples” on page
(1)
(1)
7.
183
Related parts for ATmega88PA Automotive
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
Manufacturer:
Atmel Corporation
Datasheet:
Part Number:
Description:
MCU AVR 8K ISP FLSH 20MHZ 32TQFP
Manufacturer:
Atmel
Datasheet:
Part Number:
Description:
MCU AVR 8K ISP FLASH 20MHZ 32QFN
Manufacturer:
Atmel
Datasheet:
Part Number:
Description:
MCU AVR 8K ISP FLASH 20MHZ 28DIP
Manufacturer:
Atmel
Datasheet:
Part Number:
Description:
Manufacturer:
Atmel Corporation
Datasheet:
Part Number:
Description:
MCU AVR 8KB FLASH 20MHZ 32TQFP
Manufacturer:
Atmel
Datasheet:
Part Number:
Description:
MCU AVR 8KB FLASH 20MHZ 32QFN
Manufacturer:
Atmel
Datasheet:
Part Number:
Description:
Atmega88p 8-bit Microcontroller With 8k Bytes In-system Programmable Flash
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
INTERVAL AND WIPE/WASH WIPER CONTROL IC WITH DELAY
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
Low-Voltage Voice-Switched IC for Hands-Free Operation
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
MONOLITHIC INTEGRATED FEATUREPHONE CIRCUIT
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
AM-FM Receiver IC U4255BM-M
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
Monolithic Integrated Feature Phone Circuit
Manufacturer:
ATMEL Corporation
Datasheet: