9.2 Temperature Sensor Board Support Service
This section explains how to use the MPLAB Code Configurator (MCC) framework to add TEMP SENSOR system service component for using the Temperature sensor (MCP9700A) on PIC32-BZ6 Curiosity Board. The system service helps to add the component on any applications.
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 | PIC32-BZ6Curiosity 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.
Note: It is recommended for the new users of the MPLAB Code
Configurator to refer MPLAB® Code Configurator (MCC) User’s
Guide in Reference Documentation from Related Links. Users can
add/remove different components like peripheral support and other wireless
functionality by following steps mentioned in MPLAB® Code
Configurator (MCC) Classic, refer MPLAB® Code
Configurator (MCC) Classic in Reference Documentation from Related
Links.
- 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 AN10 as ADC input channel as MCP9700A
is connected on AN10 of PIC32-BZ6Curiosity 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 PIC32-BZ6 Curiosity Board,
- Generate the code - 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);