Hardware structure diagram of IIC bus:
IIC supports multiple masters and master-slave working modes, usually master-slave working mode. In the master-slave working mode, there is only one master device (single-chip microcomputer) in the system, and the other devices are peripheral slave devices with IIC bus. In the master-slave working mode, the master device starts the data transmission (sends a start signal), generates a clock signal, and sends a stop signal. Start signal: SCL is high, SDA changes from high to low, and data transmission starts. End signal: SCL is high, SDA changes from low to high, and data transmission ends. Response signal: After receiving 8-bit data, the IC receiving data sends a specific low-level pulse to the IC sending data, indicating that the data has been received. After the CPU sends a signal to the controlled unit, it waits for the controlled unit to send a response signal. After receiving the response signal, the CPU makes a judgment on whether to continue to transmit data based on the actual situation. If no response signal is received, it is judged that the controlled unit has a fault.
Among these signals, the start signal is necessary, and the end signal and response signal can be omitted.
When the IIC bus transmits data, the data on the data line must remain stable during the high-level period of the clock signal. Only when the clock signal is low, the high or low level state of the data line is allowed to change. The
IIC bus protocol stipulates that after each byte of data is transmitted, there must be a response signal to determine whether the data transmission has been received by the other party. The response signal is generated by the receiving device. During the high-level period of the SCL signal, the receiving device pulls SDA to a low level, indicating that the data transmission is correct and a response is generated.
IIC bus timing diagram:
Many microcontrollers do not have IIC bus interface, such as 51 microcontroller.
Microcontroller simulates IIC bus communication:
Start code: void start(){
SDA = 1;
delay();
SCL = 1;
delay();
SDA = 0;
delay();
}
Stop code:
void stop(){
SDA = 0;
delay();
SCL = 1;
delay();
SDA = 1;
delay();
}
Previous article:Design of three-phase thyristor trigger circuit for microcomputer controlled welding machine
Next article:51 MCU-IO port
Recommended ReadingLatest update time:2024-11-16 16:56
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
- [AIoT Smart Smoke Detection System] Product Design Background
- Simulation research on high frequency antenna protection design
- Please give some advice on the working mode of the boost circuit
- i.MX6ULL Embedded Linux Development 6-System Burning to eMMC and the Pitfalls Encountered!
- Gowin GW1N development board logic analyzer speed test
- Which MSP430FR6972 development board is suitable?
- Please recommend some easy-to-understand books or web links about phase detectors and frequency detectors. Thank you.
- PS2 Interface.pdf
- DIY a CNC switching power supply, you need to master these knowledge
- General architecture of the hardware system of the C6000 series DSP