如何在I2C通信中知道从控制器地址 [英] How can I know a slave controller address in I2C communicatio

查看:220
本文介绍了如何在I2C通信中知道从控制器地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Q值。我是嵌入式系统的新手。我已经完成了很多数据表,现在我开始使用两个控制器(dspic30f2010)学习I2c通信。我怎么知道奴隶的地址,我将从主大师那里通过。有人请帮助我。如果可能的话,可以更多地了解它。

Q. I am new to embedded system.I have gone through so many datasheets and Now I am starting to learn I2c communication using two controllers (dspic30f2010). How can I know the slave's address which I'll pass from master master one.Anyone please help me. If possible give some more idea about it.

推荐答案

从设备地址在设备的数据表中指定。某些器件(主要是EEPROM等存储器)具有地址引脚来选择子地址。如果要寻址EEPROM,地址为1010xxxR / W,其中1010是EEPROM的预定义基址,xxx对应于三个子地址引脚,R / W是指定方向的读/写位。假设地址引脚连接到GND,EEPROM读地址为0xA1,写地址为0xA0。



如果您使用另一个微控制器作为从机,您可以选择来自任何未保留且未被连接到同一总线的其他设备使用的地址。保留地址主要设置或清除4个高位(1111xxxx和0000xxxx)。所以使用任何其他组合是安全的。
The slave address is specified in the data sheet of the device. Some devices (mainly memory like EEPROM) have address pins to select sub-addresses. If you want to address an EEPROM the address is 1010xxxR/W where 1010 is the pre-defined base address for EEPROMs, xxx corresponds to the three sub-address pins and R/W is the read/write bit specifying the direction. Assuming the address pins are connected to GND, the EEPROM read address is 0xA1 and the write address is 0xA0.

If you are using another microcontroller as slave, you can choose the address from any not reserved and not used by other devices connected to the same bus. Reserved addresses mainly have the 4 upper bits set or cleared (1111xxxx and 0000xxxx). So using any other combination is safe.


这篇关于如何在I2C通信中知道从控制器地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆