beautypg.com

Rainbow Electronics AT89C5132 User Manual

Page 126

background image

126

AT8xC5132

4173A–8051–08/02

Slave Mode with Polling
Policy

Figure 103 shows the initialization phase and the transfer phase flows using the polling
policy.

The transfer format depends on the master controller.

SPIF flag is cleared when reading SPDAT (SPSTA has been read before by the “end of
reception” check).

This policy provides the fastest effective transmission and is well adapted when commu-
nicating at high speed with other Microcontrollers. However, the procedure may be
interrupted at any time by higher priority tasks.

Figure 103. Slave SPI Polling Policy Flows

SPI Initialization

Polling Policy

Disable interrupt

SPIE = 0

SPI Transfer

Polling Policy

Data Received?

SPIF = 1?

Select Slave Mode

MSTR = 0

Select Format

Program CPOL & CPHA

Enable SPI

SPEN = 1

Prepare Next Transfer

Write Data in SPDAT

Get Data Received

Read SPDAT

Prepare Transfer

write data in SPDAT