72
ATmega161(L)
1228B–09/01
For the slave MCUs, the mechanism appears slightly different for 8-bit and 9-bit recep-
tion mode. In 8-bit reception mode (CHR9n in UCSRnB cleared), the stop bit is one for
an address byte and zero for a data byte. In 9-bit reception mode (CHR9n in UCSRnB
set), the ninth bit is one for an address byte and zero for a data byte, whereas the stop
bit is always high.
The following procedure should be used to exchange data in Multi-processor Communi-
cation Mode:
1.
All slave MCUs are in Multi-processor Communication Mode (MPCMn in UCS-
RnA is set).
2.
The master MCU sends an address byte and all slaves receive and read this
byte. In the slave MCUs, the RXCn flag in UCSRnA will be set as normal.
3.
Each slave MCU reads the UDRn register and determines if it has been
selected. If so, it clears the MPCMn bit in UCSRnA; otherwise, it waits for the
next address byte.
4.
For each received data byte, the receiving MCU will set the receive complete
flag (RXCn in UCSRnA). In 8-bit mode, the receiving MCU will also generate a
framing error (FEn in UCSRnA set), since the stop bit is zero. The other slave
MCUs, which still have the MPCMn bit set, will ignore the data byte. In this case,
the UDRn register and the RXCn, FEn, or flags will not be affected.
5.
After the last byte has been transferred, the process repeats from step 2.
UART Control
UART0 I/O Data Register –
UDR0
UART1 I/O Data Register –
UDR1
The UDRn register is actually two physically separate registers sharing the same I/O
address. When writing to the register, the UART Transmit Data register is written. When
reading from UDRn, the UART Receive Data register is read.
UART0 Control and Status
Registers – UCSR0A
UART1 Control and Status
Registers – UCSR1A
Bit
7
6
5
4
3
2
1
0
$0C ($2C)
MSB
LSB
UDR0
Read/Write
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial Value
0
0
0
0
0
0
0
0
Bit
7
6
5
4
3
2
1
0
$03 ($23)
MSB
LSB
UDR1
Read/Write
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial Value
0
0
0
0
0
0
0
0
Bit
7
6
5
4
3
2
1
0
$0B ($2B)
RXC0
TXC0
UDRE0
FE0
OR0
–
U2X0
MPCM0
UCSR0A
Read/Write
R
R/W
R
R
R
R
R/W
R/W
Initial Value
0
0
1
0
0
0
0
0
Bit
7
6
5
4
3
2
1
0
$02 ($22)
RXC1
TXC1
UDRE1
FE1
OR1
–
U2X1
MPCM1
UCSR1A
Read/Write
R
R/W
R
R
R
R
R/W
R/W
Initial Value
0
0
1
0
0
0
0
0