Lab Session 7
Lab Session 7
Lab Session 7
I2C Communication
Objective:
Interface an I2C-enabled device (e.g., external EEPROM or sensor) with the TM4C
microcontroller.
Implement I2C communication protocols for data exchange.
Read and display data from the I2C device.
Apparatus:
Theory:
Circuit Diagram:
Procedure:
1. Connect the I2C-enabled device (e.g., sensor) to the TM4C microcontroller using the
SDA and SCL pins.
2. Initialize the I2C peripheral of the microcontroller.
3. Implement I2C communication protocols to read data from the device.
4. Display the acquired data on an LCD screen or through serial communication.
Programming Code:
Input:
Output:
Assignment:
Modify the code for the following objectives with same schematic.
LED should blink in a normal way.
When an object comes near the I/R sensor, LED should start blinking faster.
The blinking speed should keep increasing if the the object remains near
Input:
Output:
Observations & Conclusions:
The program continuously requests data from the I2C-enabled device connected to the
TM4C microcontroller.
Data received from the device is displayed on the serial monitor for observation.
I2C communication allows for easy interfacing with various devices, enabling the
microcontroller to gather data from external sensors or peripherals.
This experiment demonstrates the implementation of I2C communication protocols for
data exchange with external devices, enhancing the capabilities of the microcontroller-
based system.
Conclusion:
This lab introduced participants to I2C communication protocols, facilitating the interfacing of
I2C-enabled devices with the TM4C microcontroller for data exchange. Through this exercise,
participants gained practical experience in implementing I2C communication and integrating
external sensors or peripherals into microcontroller-based systems.