15.2 Temperature Sensor Board Support Service
This document explains how to use the MPLAB Code Configurator (MCC) framework to add TEMP SENSOR system service component for using the Temperature sensor (MCP9700A) on WBZ351 Curiosity board. The system service helps to add the component on any applications.
Introduction
The TEMP SENSOR System service component has dependency of ADC Plib in order to read the temperature from MCP9700A temperature sensor. This component, uses fixed ADC reference voltage, to do the measurement.

Hardware Requirement
| S. No. | Tool | Quantity |
|---|---|---|
| 1 | WBZ351Curiosity Board | 1 |
| 2 | Micro USB cable | 1 |
SDK Setup
Refer to Getting Started with Software Development from Related Links.
Developing an Application with TEMP SENSOR SERVICE component using MPLAB Code Configurator (MCC)
This section explains the steps required by a user to integrate and use the TEMP SENSOR SERVICE component into any application.
- Create a new harmony project. For more details, see Creating a New MCC Harmony Project from Related Links.
- Ensure that wireless_system_pic32cxbz_wbz repo is available locally in the H3 repo environment.
- Open MCC. The Wireless Board Support components will be displayed in available
Device Resources --> Wireless --> Board Support as shown in the below
figure.

- Drag TEMP SENSOR SERVICE
component from Device Resources to project graph area and accept all
Dependencies or satisfiers (auto-activation components), select Yes.

- TEMP SENSOR SERVICE connects with ADCHS component inorder to measure the
temperature provided by MCP9700A. Uses default ADC configuration and configures
AN2 as ADC input channel as MCP9700A is connected on AN2 of WBZ351Curiosity Board. In case of custom board, the channel
configuration to be taken as per custom pin mapping.
Note: Refer to device datasheet for Pin configuration. - There will be a warning note on
the TEMP SENSOR SERVICE component. Satisfy the warning by configuring the needed
Pin connected to temperature sensor.
Note: Refer for device datasheet ADC pin configuration.For WBZ351 curiosity board,
- For more details on code generation, refer to MPLAB Code Configurator (MCC) Code Generation from Related Links.
- After generating the program source from MCC interface by clicking Generate
Code, the TEMP SENSOR service can be found in the following project directories.

- Compile and Run the project on the board.
TEMP SENSOR SERVICE Component API's
The below API's are available from temperature sensor component, to be called from application where ever needed.-
Reads the ADC input and converts to temperature.
float MCP9700_Temp_Fahrenheit(void);
-
Reads the ADC input and converts to temperature in Fahrenheit.
float MCP9700_Temp_Celsius(void);
