河山 发表于 2014-4-14 20:13:45

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

弱弱的问一下,I2C与Arduino Uno 硬件上是怎么接线的?是可以随便接IO口的还是特定的?请给个接线图吧。

inovaX1 发表于 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 static/image/common/back.gif
参考http://arduino.cc/en/Main/ArduinoBoardUno
A4 SDA
A5 SCL


本人E文很烂,看不懂呀,有连接图发个出来啦。

shihaipeng04 发表于 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 static/image/common/back.gif
Uno啊, vcc gnd不用说啦, sda 是 a4, scl 是a5 就这些啦

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

林定祥 发表于 2014-4-14 22:08:25

4条腿接地。

shihaipeng04 发表于 2014-4-16 10:42:14

河山 发表于 2014-4-14 21:37 static/image/common/back.gif
比如说是24C02,只接四只脚就完事了?其它脚呢?A0,A1,A2,WP这四脚让它空着吗?有什么用?

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

Super169 发表于 2014-4-16 11:17:50

其他四條, 好像是 i2c 地址選擇用的.聞說可以同時用幾個增加記憶體的.
我的還沒到手....沒測試過.

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

Super169 发表于 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 了.

eddiewwm 发表于 2014-4-19 13:12:31

河山 发表于 2014-4-14 21:37 static/image/common/back.gif
比如说是24C02,只接四只脚就完事了?其它脚呢?A0,A1,A2,WP这四脚让它空着吗?有什么用?

基本接法如下:


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

河山 发表于 2014-4-19 20:05:24

嗯,谢谢大家解答。
页: [1]
查看完整版本: 弱弱的问一下,I2C与Arduino Uno 硬件上是怎么接线的?