SPI is a full-duplex, high-speed, synchronous communication bus. It has two working modes: master mode and slave mode. In master mode, the transmission rate can reach 3mbps. When the system clock is 12Mhz, if the CPU uses a higher frequency, the rate can be higher. In slave mode, the speed cannot be too fast, usually within fsoc/8.
Data registers related to STC12 series microcontroller and SPI interface
name | address | Functional Description | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
SPCTL | 85H | SPI Control Registers | SSIG | GP | D0RD | MSTR | CP0L | CPHA | SPR1 | SPR0 |
SPSTAT | 84H | SPI fill register | SPIF | WCOL | ||||||
SPDAT | 86H | SPI Data Register |
SPCTL register function
SPSTAT register function
SPDAT.7 - SPDAT.0 -- Transmission data bits Bit7~Bit0
Looking at the SPI frame diagram, SPI has four pins: SPICLK/P1.7, MOSI/P1.5, MISO/P1.6, and SS/P1.4
The SPI clock divider selection is implemented through the SPR1 and SPR0 bits in SPCTL.
SPI write conflict: SPI is single buffered when transmitting and double buffered when receiving. If new data is written to the shift register when transmitting, WCOL will be set to indicate a data conflict; the written data will be lost and the data will continue to be sent. When the host or slave performs write conflict detection, the probability of a write conflict in the host is very low because the host has full control over the data transmission, but a write conflict may occur in the slave because the slave cannot control the transmission. When receiving data, the received data is transferred to a parallel read data buffer, which will release the shift register for the next data reception; but the received data must be read out before the next character is completely shifted in, otherwise the previous data will be lost.
For specific host connection configuration mode diagram, please refer to P299
Previous article:89 Summary of C language preprocessing instructions
Next article:51 single chip microcomputer controlled temperature sensor DS18B20
Recommended ReadingLatest update time:2024-11-16 11:33
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- MSP430 Ultra-Low Power MCUs – Design and Development
- IAR is crazy, has anyone encountered this?
- HuaDa HC32F460 series MCU internal FLASH made into USB flash drive
- PCB wiring and layout and circuit design 268 design specifications
- [ESK32-360 Review] + Construction of development environment
- Several circuit designs that must be understood by microcontrollers
- Share an article I read about PLL integer boundary spurs by IDT (Renesas)
- I can't read the TMP275 temperature sensor. I use the STM32 I/O to simulate IIC. Please help.
- Understanding GaN Device Thermal Analysis
- 5. Control objects in previous “Control” competitions