I2C bus Learning (IV)-read/write process

Source: Internet
Author: User

Write Process

When the MCU performs write operations, it first sends the 7-bit address code of the device and the Write direction "0" (a total of 8 bits, that is, one byte ), after sending the message, the SDA line is released and 9th clock signals are generated on the SCL line. After confirming that the selected memory device is its own address, a response signal is generated on the SDA line. After receiving the response, the MCU can transmit the data.

When transmitting data, the microcontroller first sends the first address of a byte written to the device's storage zone. After receiving the response from the memory device, the microcontroller sends each Data byte one by one, however, after each byte is sent, the system waits for a response. After the data to be written is transmitted, the microcontroller should send a termination signal to end the write operation. Format of data written into n Bytes:

Read Process

The microcontroller first sends the device's 7-bit address code and the Write direction bit "0" ("pseudo write"). After sending the code, the SDA line is released and 9th clock signals are generated on the SCL line. The selected memory device generates a response signal on the SDA line after confirming that it is its own address. Then, send a byte to read the first address of the device's storage area. After receiving the response, the microcontroller must repeat the start signal and send the device address and read direction ("1 "), after receiving the device response, you can read the data bytes. Each time you read one byte, the microcontroller must reply to the response signal. When the last byte of data is read, the microcontroller should return a "non-response" (high level), and send a termination signal to end the reading operation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.