免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1443 | 回复: 0
打印 上一主题 下一主题

I2C Hardware Basic [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-24 22:55 |只看该作者 |倒序浏览
I2C Hardware Basic

1.       GENERAL CHARACTERISTICS
I choose five basical feature to give us a general preview of i2c hardware:
1)  Only two bus lines are required; a serial data line (SDA) and a serial clock line (SCL)
2)  Each device is recognized by a unique address (whether it’s a microcontroller, LCD driver, memory or keyboard  interface) and can operate as either a transmitter or receiver, depending on the function of the device.
3)  In addition to transmitters and receivers, devices can also be considered as masters or slaves when performing data transfers. A master is the device which initiates a data transfer on the bus and generates the clock signals to permit that transfer. At that time, any device addressed is considered a slave.
Note: Masters can operate as master-transmitters or as master-receivers
4)  Generation of clock signals on the I2C-bus is always the responsibility of master devices; each master generates its own clock signals when transferring data on the bus。One clock pulse is generated for each data bit transferred
5)  Serial, 8-bit oriented, bi-directional data transfers can be made at up to 100 kbit/s in the Standard-mode, up to 400 kbit/s in the Fast-mode, or up to 3.4 Mbit/s in the High-speed mode

2.       DATA TRANSFER
1)       Data validity
The data on the SDA line must be stable during the HIGH period of the clock. The HIGH or LOW state of the data line can only change when the clock signal on the SCL line is LOW (see Fig.A.1)

Fig1.  Bit transfer on the I2C-bus

2)       START and STOP conditions
A HIGH to LOW transition on the SDA line while SCL is HIGH indicates a START condition.
A LOW to HIGH transition on the SDA line while SCL is HIGH defines a STOP condition.
START and STOP conditions are always generated by the master.
The bus is considered to be busy after the START condition. The bus is considered to be free again a certain time after the STOP condition.

Fig2.  START and STOP conditions.

3)        Byte format
Every byte put on the SDA line must be 8-bits long. The number of bytes that can be transmitted per transfer is unrestricted. Each byte has to be followed by an acknowledge bit.


Fig3.  Data transfer on the I2C-bus.

4)       Acknowledge
Data transfer with acknowledge is obligatory. The acknowledge-related clock pulse is generated by the master. The transmitter releases the SDA line (HIGH) during the acknowledge clock pulse.The receiver must pull down the SDA line during the acknowledge clock pulse so that it remains stable LOW during the HIGH period of this clock pulse (see Fig.A.4).Usually, a receiver which has been addressed is obliged to generate an acknowledge after each byte has been received, When a slave doesn’t acknowledge the slave address (for example, it’s unable to receive or transmit because it’s performing some real-time function), the data line must be left HIGH by the slave. The master can then generate either a STOP condition to abort the transfer, or a repeated START condition to start a new transfer.

If a master-receiver is involved in a transfer, it must signal the end of data to the slave- transmitter by not generating an acknowledge on the last byte that was clocked out of the slave. The slave-transmitter must release the data line to allow the master to generate a STOP or repeated START condition.


Fig4.  Acknowledge on the I2C-bus.

5)       FORMATS WITH 7-BIT ADDRESSES
Data transfers follow the format shown in Fig.A.5.
After the START condition (S), a slave address is sent. This address is 7 bits long followed by an eighth bit which is a data direction bit (R/W) - a ‘zero’ indicates a transmission (WRITE), a ‘one’ indicates a request for data (READ).
A data transfer is always terminated by a STOP condition (P) generated by the master.

Fig.A.5  A complete data transfer

Reference:
[1] The IIC-bus specification -v2.1


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/60011/showart_1334796.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP