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-client2-mplab-mcc

Repository files navigation

MCHP

UART-I2C Bridge Implementation: I2C Client(Client-2) Implementation using PIC16F15244 Microcoontroller

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

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

Related Documentation

Description

In this code example, the PIC16F15244 microcontroller communicate with Data Visualizer terminal window application, running on a PC, through USART interface and receive user inputs/commands. Based on the commands received from the user, the PIC16F15244 microcontroller communicates with the I2C client devices and collect the required sensors data and, transmit to PC for displaying it on the terminal window. This way, the PIC16F15244 microcontroller acts as a EUART-I2C bridge to communicate with 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 as client 1 and client 2 and, they are based on PIC16F15244 microcontroller. Figure 1 shows the block diagram view of the application.


Figure 1 : Block diagram view of the application

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

The input commands and clients I2C address information has been displayed on the terminal window of 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 host request with the processed sensor data. Upon receiving the sensor data, the host device transmits data to data visualizer tool through UART interface, for displaying it on the terminal window. If the user entered client address or sensor input command is incorrect, then terminal window display the supplied client address or sensor information is incorrect and requests the user to re-enter details.

Software Used

  • MPLAB® X IDE 6.0.0 or newer
  • MPLAB® XC8 2.36.0 or newer
  • MPLAB® Code Configurator (MCC) 5.1.1 or newer
  • Microchip PIC16F1xxxx Series Device Support 1.9.163 or newer
  • MCC Melody Core 2.1.9
  • MSSP MCC Melody Core 6.1.1
  • ADC MCC Melody Core 3.0.6
  • TMR0 MCC Melody Core 4.0.8
  • UART MCC Melody Core 1.6.0

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