ATMEGA2561V ATMEL [ATMEL Corporation], ATMEGA2561V Datasheet - Page 238

no-image

ATMEGA2561V

Manufacturer Part Number
ATMEGA2561V
Description
8-bit Microcontroller with 64K/128K/256K Bytes In-System Programmable Flash
Manufacturer
ATMEL [ATMEL Corporation]
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
ATMEGA2561V-8AI
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATMEGA2561V-8AU
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATMEGA2561V-8AU
Manufacturer:
ALTERA
0
Part Number:
ATMEGA2561V-8AU
Manufacturer:
ATMEL/爱特梅尔
Quantity:
20 000
Part Number:
ATMEGA2561V-8AUR
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATMEGA2561V-8MI
Manufacturer:
ATMEL/爱特梅尔
Quantity:
20 000
Part Number:
ATMEGA2561V-8MU
Manufacturer:
ATMEL/爱特梅尔
Quantity:
20 000
Frame Formats
USART MSPIM Initialization
238
ATmega640/1280/1281/2560/2561
Figure 89. UCPHAn and UCPOLn data transfer timing diagrams.
A serial frame for the MSPIM is defined to be one character of 8 data bits. The USART
in MSPIM mode has two valid frame formats:
A frame starts with the least or most significant data bit. Then the next data bits, up to a
total of eight, are succeeding, ending with the most or least significant bit accordingly.
When a complete frame is transmitted, a new frame can directly follow it, or the commu-
nication line can be set to an idle (high) state.
The UDORDn bit in UCSRnC sets the frame format used by the USART in MSPIM
mode. The Receiver and Transmitter use the same setting. Note that changing the set-
ting of any of these bits will corrupt all ongoing communication for both the Receiver and
Transmitter.
16-bit data transfer can be achieved by writing two data bytes to UDRn. A UART trans-
mit complete interrupt will then signal that the 16-bit value has been shifted out.
The USART in MSPIM mode has to be initialized before any communication can take
place. The initialization process normally consists of setting the baud rate, setting mas-
ter mode of operation (by setting DDR_XCKn to one), setting frame format and enabling
the Transmitter and the Receiver. Only the transmitter can operate independently. For
interrupt driven USART operation, the Global Interrupt Flag should be cleared (and thus
interrupts globally disabled) when doing the initialization.
Note:
Before doing a re-initialization with changed baud rate, data mode, or frame format, be
sure that there is no ongoing transmissions during the period the registers are changed.
The TXCn Flag can be used to check that the Transmitter has completed all transfers,
and the RXCn Flag can be used to check that there are no unread data in the receive
buffer. Note that the TXCn Flag must be cleared before each transmission (before
UDRn is written) if it is used for this purpose.
The following simple USART initialization code examples show one assembly and one
C function that are equal in functionality. The examples assume polling (no interrupts
8-bit data with MSB first
8-bit data with LSB first
XCK
Data setup (TXD)
Data sample (RXD)
Data setup (TXD)
Data sample (RXD)
XCK
To ensure immediate initialization of the XCKn output the baud-rate register (UBRRn)
must be zero at the time the transmitter is enabled. Contrary to the normal mode USART
operation the UBRRn must then be written to the desired value after the transmitter is
enabled, but before the first transmission is started. Setting UBRRn to zero before
enabling the transmitter is not necessary if the initialization is done immediately after a
reset since UBRRn is reset to zero.
UCPOL=0
Data setup (TXD)
Data sample (RXD)
Data setup (TXD)
Data sample (RXD)
XCK
XCK
UCPOL=1
2549K–AVR–01/07

Related parts for ATMEGA2561V