Rainbow Electronics AT89LP216 User Manual
Page 54
54
3621A–MICRO–6/06
AT89LP216 [Preliminary]
The CPHA (Clock PHAse), CPOL (Clock POLarity), and SPR (Serial Peripheral clock Rate =
baud rate) bits in SPCR control the shape and rate of SCK. The two SPR bits provide four possi-
ble clock rates when the SPI is in master mode. In slave mode, the SPI will operate at the rate of
the incoming SCK as long as it does not exceed the maximum bit rate. There are also four pos-
sible combinations of SCK phase and polarity with respect to the serial data. CPHA and CPOL
determine which format is used for transmission. The SPI data transfer formats are shown in
. To prevent glitches on SCK from disrupting the interface, CPHA, CPOL,
and SPR should not be modified while the interface is enabled, and the master device should be
enabled before the slave device(s).
Figure 18-4. SPI Transfer Format with CPHA = 0
Note:
*Not defined but normally MSB of character just received.
Figure 18-5. SPI Transfer Format with CPHA = 1
Note:
*Not defined but normally LSB of previously transmitted character.
MSB
6
5
4
3
2
1
LSB
1
2
3
4
5
6
7
8
MSB
*
6
5
4
3
2
1
LSB
SCK CYCLE #
(FOR REFERENCE)
SCK (CPOL = 0)
SCK (CPOL = 1)
MOSI
(FROM MASTER)
MISO
(FROM SLAVE)
SS (TO SLAVE)