Contents
What is I2C microcontroller?
I2C, or Inter-integrated Circuit, is a communications protocol common in microcontroller-based systems, particularly for interfacing with sensors, memory devices and liquid crystal displays. Similar to SPI, it’s a synchronous protocol because it uses a clock line.
What is I2C pic?
The term IIC stands for “Inter Integrated Circuits”. It is normally denoted as I2C or I squared C or even as 2-wire interface protocol (TWI) at some places but it all means the same. I2C is a synchronous communication protocol meaning, both the devices that are sharing the information must share a common clock signal.
What are the pins provided for I2C communication in PIC microcontroller?
Two pins are used for data transfer: Serial clock (SCL) – RB1/AN10/INT1/SCK/SCL. Serial data (SDA) – RB0/AN12/INT0/FLT0/SDI/SDA.
Which micro controller can support I2C protocol?
PIC18F4550 I2C Programming MPLAB XC8 PIC184550 Microcontroller has Master Synchronous Serial Port (MSSP) module. MSSP supports SPI and I2C communication. MAAP module can be used either in SPI or I2C modes or both also.
How does I2C work in microcontroller?
I2C is a serial communication protocol, so data is transferred bit by bit along a single wire (the SDA line). Like SPI, I2C is synchronous, so the output of bits is synchronized to the sampling of bits by a clock signal shared between the master and the slave. The clock signal is always controlled by the master.
Where to use I2C communication with PIC microcontroller?
Where to use I2C communication? I2C communication is used only for short distance communication. It is certainly reliable to an extent since it has a synchronised clock pulse to make it smart. This protocol is mainly used to communicate with sensor or other devices which has to send information to a master.
Which is the best compiler for I2C communication?
We will see I2C code examples with two popular compilers such as MPLAB XC8 and MikroC Pro. At the start, we will see the introduction of I2C communication. Secondly, we will understand the control and configuration registers of PIC Microcontroller I2C module.
How does a PIC microcontroller work as a slave?
As mentioned above, on an I2C bus there can be multiple slaves limited by the address size. A pic device can be configured as a slave by selecting the appropriate slave mode using SSPM<3:0> bits in SSPCON register. Along with SSPM bits, the synchronous port must be enabled by setting the SSPEN bit in the same register.
What are the input pins for the PIC microcontroller?
The first step would be to declare the IIC pins as input pins, here the pins RC3 and RC4 should be used for I2C communication so we declare them as input pins. Next we should set the SSPCON and SSPCON2 which is a MSSP control registers. We are operating the PIC in IIC master mode with a clock frequency of FOSC/ (4 * (SSPADD + 1)).