Can someone give a thorough definition of exactly how the I2C interface works and how to use it on the Netduino? I think many of us micro controller newbs know what it is but don't understand whats going on.
I know many components use this interface but what is really happening and how can we use it?
A perfect example what be an explanation of the LCD I2C 1602 screen. Whats going on step by step?
Thank you.
Getting started with I2C
Started by Bendage, Mar 11 2012 04:05 AM
2 replies to this topic
#2
Posted 11 March 2012 - 07:36 AM
Can someone give a thorough definition of exactly how the I2C interface works and how to use it on the Netduino? I think many of us micro controller newbs know what it is but don't understand whats going on.
I would very much like to second this request.
When you talk EE use small words, I'm just a Software Developer
My Blog/Site and Everything Else
If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.
Oh my. So many things, so little money!!
#3
Posted 11 March 2012 - 04:25 PM
Here's a short general explanation of I2C based on my own experiences:
I2C is a serial bus requiring only two wires - one data line (SDA) and one clock line (SCL), hence I2C is also referred to as "two-wire" or "2w" for short.
One chip acts master and is responsible for providing the clock signal (SCL) while any other chip connected to the bus will act as a slave. Each slave chip has a 7 bit address that it listens to. The master chip uses the address to select a certain chip as the target of communication.
The data line is bidirectional and the master chip appends an 8th bit after the 7 address bits. This additional bit is called the "read/write bit" and is used by the master to tell the targeted slave to either receive data from the master (write mode) or to send data to the master (read mode). After the first 8 bits comes the data bits (bytes) in either direction.
Along with the data bits exchanged between a master and a slave, there are acknowledge bits sent back and forth on the data line. As far as I know, communication can only take place between the master and exactly one slave at a time and communication is always initiated by the master.
I think the Netduino can only act as an I2C master.
Usually, the datasheet of an I2C capable device will give you some description of the I2C bus along with timing diagrams to further describe what is going on the bus during communication.
Hope this helps!
EDIT: When using I2C, don't forget the pull up resistors on both the SCL and SDA lines or it won't work at all. This is easy to forget since these pulls ups are generally not mentioned or in place per se. I use 4.7k resistors for this. Also note that some datasheets include the r/w bit in the chip address to form an 8 bit address and this can be very confusing.
I2C is a serial bus requiring only two wires - one data line (SDA) and one clock line (SCL), hence I2C is also referred to as "two-wire" or "2w" for short.
One chip acts master and is responsible for providing the clock signal (SCL) while any other chip connected to the bus will act as a slave. Each slave chip has a 7 bit address that it listens to. The master chip uses the address to select a certain chip as the target of communication.
The data line is bidirectional and the master chip appends an 8th bit after the 7 address bits. This additional bit is called the "read/write bit" and is used by the master to tell the targeted slave to either receive data from the master (write mode) or to send data to the master (read mode). After the first 8 bits comes the data bits (bytes) in either direction.
Along with the data bits exchanged between a master and a slave, there are acknowledge bits sent back and forth on the data line. As far as I know, communication can only take place between the master and exactly one slave at a time and communication is always initiated by the master.
I think the Netduino can only act as an I2C master.
Usually, the datasheet of an I2C capable device will give you some description of the I2C bus along with timing diagrams to further describe what is going on the bus during communication.
Hope this helps!
EDIT: When using I2C, don't forget the pull up resistors on both the SCL and SDA lines or it won't work at all. This is easy to forget since these pulls ups are generally not mentioned or in place per se. I use 4.7k resistors for this. Also note that some datasheets include the r/w bit in the chip address to form an 8 bit address and this can be very confusing.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users