EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Sysnchronous Serial Peripheral Interface (SPI); SPI Function Pin Switch; Registers Related to SPI; SPI Status Register (SPSTAT)

Default Icon
901 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
STC8A8K64D4 Series Manual
- 566 -
20 Sysnchronous Serial Peripheral Interface (SPI)
A high-speed serial communication interface, SPI, is integrated in STC8A8K64D4 series of microcontrollers. SPI
is a full-duplex high-speed synchronous communication bus. SPI interface integrated in the STC8A8K64D4 series of
microcontrollers offers two operation modes: master mode and slave mode.
20.1 SPI function pin switch
Symbol
Address
B7
B6
B5
B4
B3
B2
B1
B0
P_SW1
A2H
S1_S[1:0]
CCP_S[1:0]
SPI_S[1:0]
0
-
SPI_S[1:0]: SPI function pin selection bit
SPI_S[1:0]
SS
MOSI
MISO
SCLK
00
P1.2
P1.3
P1.4
P1.5
01
P2.2
P2.3
P2.4
P2.5
10
P7.4
P7.5
P7.6
P7.7
11
P3.5
P3.4
P3.3
P3.2
20.2 Registers Related to SPI
Symbol
Description
Address
Bit Address and Symbol
Reset
Value
B7
B6
B5
B4
B3
B2
B1
B0
SPSTAT
SPI Status register
CDH
SPIF
WCOL
-
-
-
-
-
-
00xx,xxxx
SPCTL
SPI Control Register
CEH
SSIG
SPEN
DORD
MSTR
CPOL
CPHA
SPR[1:0]
0000,0100
SPDAT
SPI Data Register
CFH
0000,0000
20.2.1 SPI Status register (SPSTAT)
Symbol
Address
B7
B6
B5
B4
B3
B2
B1
B0
SPSTAT
CDH
SPIF
WCOL
-
-
-
-
-
-
SPIF: SPI transfer completion flag.
When SPI completes sending / receiving 1 byte of data, the hardware will automatically set this bit and request
interrupt to CPU. If the SSIG bit is set to 0, this flag will also be automatically set by hardware to indicate a mode
change of device when the master / slave mode of the device changes due to changes in the SS pin level.
Note: This bit must be cleared using software writing 1 to it.
WCOL: SPI write collision flag bit.
This bit is set by hardware when the SPI is writing to the SPDAT register during data transfer.
Note: This bit must be cleared using software by writing 1 to it.
20.2.2 SPI Control Register (SPCTL)
Symbol
Address
B7
B6
B5
B4
B3
B2
B1
B0
SPCTL
CEH
SSIG
SPEN
DORD
MSTR
CPOL
CPHA
SPR[1:0]
SSIG: Control bit of whether SS pin is ignored or not.
0: the SS pin decides whether the device is a master or slave.
1: the function of SS pin is ignored. MSTR decides whether the device is a master or slave.
SPEN: SPI enable bit.
0: the SPI is disabled.
1: the SPI is enabled.

Table of Contents

Related product manuals