11 SYNCHRONOUS SERIAL INTERFACE (SPI)
11-6
Seiko epson Corporation
S1C17F13 TeChniCal Manual
(Rev. 1.0)
5. Repeat Steps 2 to 4 (or 2 and 3) until the end of transmit data.
6. Negate the slave select signal by controlling the general-purpose output port (if necessary).
Data sending operations
The SPI Ch.
n
starts data sending operations when transmit data is written to the SPI
n
TXD register.
The transmit data in the SPI
n
TXD register is automatically transferred to the shift register and the SPI
n
INTF.
TBEIF bit is set to 1. If the SPI
n
INTE.TBEIE bit = 1 (transmit buffer empty interrupt enabled), a transmit buf-
fer empty interrupt occurs at the same time.
The SPICLK
n
pin outputs eight clocks and the transmit data bits are output in sequence from the SDO
n
pin in
sync with this clock.
Even if the clock is being output from the SPICLK
n
pin, the next transmit data can be written to the SPI
n
TXD
register after making sure the SPI
n
INTF.TBEIF bit is set to 1.
If transmit data has not been written to the SPI
n
TXD register after the eighth clock is output from the SPICLK
n
pin, the clock output halts and the SPI
n
INTF.TENDIF bit is set to 1. At the same time the SPI issues an end-of-
transmission interrupt request if the SPI
n
INTE.TENDIE bit = 1.
SPICLK
n
SDO
n
SPI
n
INTF.TBEIF
SPI
n
INTF.TENDIF
Software operations
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
Data (W)
→
SPI
n
TXD
Data (W)
→
SPI
n
TXD
1 (W)
→
SPI
n
INTF.TENDIF
Data (W)
→
SPI
n
TXD
5.2.1 Example of Data Sending Operations in Master Mode
Figure 11.
Data transmission
End
Negate the slave select signal output from
a general-purpose port
(
)
Assert the slave select signal output from
a general-purpose port
(
)
Read the SPI
n
INTF.TBEIF bit
Write transmit data to
the SPI
n
TXD register
YES
NO
NO
YES
Transmit data remained?
SPI
n
INTF.TBEIF = 1 ?
Wait for an interrupt request
(SPI
n
INTF.TBEIF = 1)
5.2.2 Data Transmission Flowchart in Master Mode
Figure 11.