极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 26045|回复: 10

弱弱的问一下,I2C与Arduino Uno 硬件上是怎么接线的?

[复制链接]
发表于 2014-4-14 20:13:45 | 显示全部楼层 |阅读模式
弱弱的问一下,I2C与Arduino Uno 硬件上是怎么接线的?是可以随便接IO口的还是特定的?请给个接线图吧。
回复

使用道具 举报

发表于 2014-4-14 20:29:39 | 显示全部楼层
参考http://arduino.cc/en/Main/ArduinoBoardUno
A4 SDA
A5 SCL
或者直接在靠usb口处找,板子背面有字的

Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions:

-Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.

-External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.

-PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.

-SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library.

-LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.


The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and the analogReference() function. Additionally, some pins have specialized functionality:

-TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire library.


There are a couple of other pins on the board:

-AREF. Reference voltage for the analog inputs. Used with analogReference().

-Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-4-14 20:38:24 | 显示全部楼层
inovaX1 发表于 2014-4-14 20:29
参考http://arduino.cc/en/Main/ArduinoBoardUno
A4 SDA
A5 SCL

本人E文很烂,看不懂呀,有连接图发个出来啦。
回复 支持 反对

使用道具 举报

发表于 2014-4-14 21:32:16 | 显示全部楼层
Uno啊, vcc gnd不用说啦, sda 是 a4, scl 是a5 就这些啦
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-4-14 21:37:45 | 显示全部楼层
shihaipeng04 发表于 2014-4-14 21:32
Uno啊, vcc gnd不用说啦, sda 是 a4, scl 是a5 就这些啦

比如说是24C02,只接四只脚就完事了?其它脚呢?A0,A1,A2,WP这四脚让它空着吗?有什么用?
回复 支持 反对

使用道具 举报

发表于 2014-4-14 22:08:25 | 显示全部楼层
4条腿接地。
回复 支持 反对

使用道具 举报

发表于 2014-4-16 10:42:14 | 显示全部楼层
河山 发表于 2014-4-14 21:37
比如说是24C02,只接四只脚就完事了?其它脚呢?A0,A1,A2,WP这四脚让它空着吗?有什么用?

芯片级的?不晓得啦, 我的eeprom 是模块的,只有4只脚。至于他里面线路咋连的?我看不懂
回复 支持 反对

使用道具 举报

发表于 2014-4-16 11:17:50 | 显示全部楼层
其他四條, 好像是 i2c 地址選擇用的.  聞說可以同時用幾個增加記憶體的.
我的還沒到手....沒測試過.

shihaipeng04 兄的模塊可以換芯片嗎?  用過 AT24C1024 沒有?
我訂了一個可換的 (預裝了 AT24C256, 本來同時訂了 AT24C512 及 AT24C1024, 但1024缺貨), 上面幾四組針腳, 應該是對應那四個用來選擇地址的.  

回复 支持 反对

使用道具 举报

发表于 2014-4-17 23:26:58 | 显示全部楼层
本帖最后由 Super169 于 2014-4-17 23:50 编辑

剛測試了, A0 A1 是兩個地址針腳,  可選 0x50, 0x51, 0x52 及 0x53, 可以同時用4 顆, 另外 WP 是寫入保護, NC 是沒用的.

再看看 AT24C1024 的資料, 只有一個地址針腳, 即最多只可以用 2 顆1024 或 4 顆 512, 合共就是最多 256KB 了.
回复 支持 反对

使用道具 举报

发表于 2014-4-19 13:12:31 | 显示全部楼层
河山 发表于 2014-4-14 21:37
比如说是24C02,只接四只脚就完事了?其它脚呢?A0,A1,A2,WP这四脚让它空着吗?有什么用?

基本接法如下:


A0,A1,A2 是地址腳,WP 是防寫保護。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-4-19 20:05:24 | 显示全部楼层
嗯,谢谢大家解答。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-5 20:08 , Processed in 0.039717 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表