10.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 Required

Table 10-2. 
ToolQty
WBZ351Curiosity Board1
Micro USB cable1

SDK Setup

  1. Getting Started with Software Development

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.

Tip: New users of MPLAB Code Configurator (MCC) are recommended to go through the overview of MCC. Users can add/remove different components like peripheral support and other wireless functionality by following steps mentioned here.

  1. Create a new MCC Harmony Project -- link for instructions
  2. Ensure that wireless_system_pic32cxbz_wbz repo is available locally in the H3 repo environment.
  3. Open MCC. The Wireless Board Support components will be displayed in available Device Resources --> Wireless --> Board Support as shown in the below figure.
  4. Drag TEMP SENSOR SERVICE component from Device Resources to project graph area and accept all Dependencies or satisfiers(auto-activation components), select "Yes".
  5. 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
  6. 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,
  7. Generate the code. Refer link for more details.
  8. After generating the program source from MCC interface by clicking Generate Code, the TEMP SENSOR service can be found in the following project directories.
  9. 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.
  1. Reads the ADC input and converts to temperature

    float MCP9700_Temp_Fahrenheit(void);

  2. Reads the ADC input and converts to temperature in Fahrenheit

    float MCP9700_Temp_Celsius(void);