|
发表于 2010-10-17 14:56:11
|
显示全部楼层
你看到的帮助应该是这句话:
Sends a single byte over the I2C interface.
In master mode this function will generate a clock with the data and in slave mode it will wait for the clock from the master.
No automatic timeout is provided in this function.
This function returns the ACK bit.
The LSB of the first write after a start determines the direction of data transfer (0 is master to slave).
Note that specific I2C protocol depends on the slave device.
我给你翻了一下书:
找到关于 ack = i2c_write(0xa0);的一些解释
/*---------------------------------------------------
在I2C输出1字节的数据。
主动模式输出时钟,从动模式时等待从动主机方来的时钟。
不使用内置SSP模块时,不会发生超时溢出,故一直等待到发送结束。
发送结束,返回ACK位。
正常ACK时返回0,没有ACK时返回1.
---------------------------------------------------*/
我理解的是 在使用I2C时 用主控模式,
#use I2C(master, sda=PIN_B0, scl=PIN_B1) |
|