Hardware Reference
In-Depth Information
up to 100 kHz but numerous specii cations existed. The newest in 2012 allows
for 5 MHz clock speeds.
Another name for I 2 C is the Two Wire Interface (shortened to TWI). This is
where the Wire library gets its name.
Connecting I 2 C
I 2 C requires two data wires, as well as a common ground. The two wires are
called SDA (for Serial Data), and SCL (for Serial Clock). All devices in the I 2 C
network are connected to these two wires. Both SDA and SCL lines are open
drain, meaning that the devices can force their value low but cannot provide
power, which will be provided directly from the main power line. For I 2 C to
work, these two lines must be equipped with pull-up resistors, as shown in
Figure 8-2. The values are not critical, and values range widely; 4.7 kilohm resis-
tors are common. Arduinos have internal pull-up resistors that are automatically
activated on both the SDA and SCL lines when the I 2 C connection is initialized.
This is illustrated in Figure 8-2.
+5V
A
B
C
SCL
SDA
Figure 8-2: Pull-up resistors to SDA and SCL lines
Connecting multiple I 2 C devices is extremely easy; there is no notion of chip
select, chip activate, or any other mechanism. All SDA pins are connected
together, and all SCL pins are also connected together. The I 2 C protocol dei nes
which circuit is to respond.
I 2 C Protocol
I 2 C is a master/slave network; the master initiates the communication, and the
slave responds. Each I 2 C slave has a specii c address, and the master must send
this address to the network for a slave to answer. The I 2 C protocol has several
 
Search WWH ::




Custom Search