Skip to content

This example demonstrates UART-I2C bridge implementation using PIC MCU.The PIC16F15244 MCU processes periodically acquired sensor data and also acts as a I2C client. Compatible PIC16F152xx family of MCUs are PIC16F15214,PIC16F15223,PIC16F15254,PIC16F15276

License

Notifications You must be signed in to change notification settings

microchip-pic-avr-examples/pic16f15244-uart-i2c-bridge-i2c-client1-mplab-mcc

Repository files navigation

MCHP

UART-I2C Bridge Implementation: I2C Client(Client-1) Implementation Using the PIC16F15244 Microcontroller

This code example is a good use case to demonstrate UART-I2C bridge implementation using the PIC16F152xx family microcontrollers. In this code example, PIC16F15244 MCU acts as an I2C client as device 1. It periodically collects the data from the sensor, process the acquired data and keep the data ready to transmit to the Host device over the I2C interface. When the Host device requests to send the processed sensor data, then the client device responds back to the host request with the processed data through the I2C interface. After receiving the data from the client device, the host device displays the data on the terminal window.

Refer to the GitHub code example UART-I2C Bridge and I2C Host Implementation using PIC16F15244 Microcontroller and UART-I2C Bridge Implementation: I2C Client(Client-2) Implementation using PIC16F15244 Microcontroller for more details about the application.

Related Documentation

Description

In this code example, the PIC16F15244 microcontroller communicate with the Data Visualizer terminal window application, running on a PC, through the USART interface and receives user inputs/commands. Based on the commands received from the user, the PIC16F15244 microcontroller communicates with the I2C client devices and collects the required sensors data and transmit to PC for displaying it on the terminal window. Thus, the PIC16F15244 microcontroller acts as a EUART-I2C bridge to communicate with the Data Visualizer terminal window application and acts as a I2C host device to communicate with the I2C client devices.

The code example uses two I2C clients, named Client 1 and Client 2, which are based on the PIC16F15244 microcontroller. Figure 1 shows the block diagram view of the application.


Figure 1 : Block diagram view of the application

For demonstration purposes, the pH sensor is interfaced to Client 1 and, temperature and capacitive soil moisture sensors are interfaced to Client 2. Both clients periodically collect data from the sensors, process the acquired data and keep the data ready to transmit to the Host device over the I2C interface.

The input commands and I2C client address information have been displayed on the terminal window of the Data Visualizer. The user needs to enter a client device address from where the sensor data needs to be collected. If the entered client device address is correct, then the next input command, asking the user to enter sensor information from where data needs to be collected, is displayed on the terminal window. After entering the correct sensor information, the host device establishes I2C communication with the respective client device and requests to send the processed sensor data. The client device responds back to the host request with the processed sensor data. Upon receiving the sensor data, the host device transmits data to the Data Visualizer tool through the UART interface, for displaying it on the terminal window. If the client address or sensor input command entered by the user is incorrect, then terminal window display supplied by the client address or the sensor information is incorrect and requests the user to re-enter more details.

Software Used

Hardware Used

Demo Operation

To know about the demo operation, refer GitHub code example UART-I2C Bridge and I2C Host Implementation using PIC16F15244 Microcontroller

About

This example demonstrates UART-I2C bridge implementation using PIC MCU.The PIC16F15244 MCU processes periodically acquired sensor data and also acts as a I2C client. Compatible PIC16F152xx family of MCUs are PIC16F15214,PIC16F15223,PIC16F15254,PIC16F15276

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published