How does the host determine the address of the device on the IIC bus? _i2c

Source: Internet
Author: User

Each device on the IIC needs an address register to determine its own address.

Each device on the IIC needs an address register to determine its own address: Many devices are used to determine the address by hardware.
Some in the factory when the address is set up, the user can not change, some identified several, the remaining several by the hardware to determine (for example, there are three users determined by the user, leaving 3 control address of the pin), this class more; There are address registers.

"If the host to send the address from the machine, how to know this address is the host, this address is how to calculate the"
Strictly speaking, the host is not sending an address to the machine, but the host to send the address to the bus (this address is a machine, not the host, so there is no "from the computer how to know this address is the host" problem), all from the machine can receive the address issued by the host, Then each from the machine will send the address of the host compared to their address, if the match, the machine will send a response signal to the host. When the host receives the response signal, it begins to send data to the bus, and the communication from the machine is established. If the host does not receive a response signal, the address fails.

"For example, the IIC bus has two monolithic microcomputer, one is the host, the other is from the machine, how to define this address from the machine"
If it is a microcontroller with IIC, there will be address register, the value in the register is it as the address from the machine.
Take ATmega48 as an example, there is TWI address register-twar, first to determine the operating mode (host mode or from machine mode), if the work in the machine mode, TWI will respond according to this address.
If it is a single-chip microcomputer without IIC, there is no address register. So it's not generally used for the machine. Taking At89c51 as an example, it is generally used as a host to simulate IIC time series with its ordinary IO port. Under special circumstances 51 as a machine, you can scan the bus way, if found on the bus to respond to an address signal (strictly speaking, this is only on the basis of IIC user-defined means of communication).

The most common case, as previously mentioned, is the role of the master-slave device is determined, that is, from the machine has been working in the slave mode. Its address determination method I've already said that. Different devices define the address in different ways, some software definitions, some hardware definitions. You find a data manual to see it, it's hard to understand.

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.