Kinetis SDK v.1.2 Demo Applications User's Guide  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Thermistor Lab CADC Demo

This demo application demonstrates how to use PDB to trigger ADC and measure on-board thermistor.

Overview

This lab shows how to configure and use the ADC module to sample the differential voltage across on-board thermistors RT1-RT4. If the user touches any on-board thermistor with a finger, the lab application detects a change in the thermistor temperature and starts flashing the corresponding LED pair.

Supported Hardware

This Tower System module is supported by the Thermistor Lab demo.

-TWR-KV46F150M

System Requirement

Hardware requirements

Toolchain requirements

Software requirements

Getting Started

Prepare the Demo

  1. Short pin 1-2 & 3-4 on J1, J2, J19 and J23.
  2. Download the program to the target board.
  3. Touch 4 on-board thermistor to see LED change.

For detailed instructions, see a Kinetis SDK User's Guide for your board.

Demo Code Overview

The lab application configures both CADCs to be software triggered in simultaneous differential mode. The CADC is configured to be in a 12-bit differential and ping-pong mode.

When an ADC conversion is complete, an interrupt is generated by the ADC module and an interrupt service routine is executed. The interrupt service routine ADCn_ISR() calls the ADCn_Task which executes these tasks:

reads ADC results registers. filters ADC results with low-pass FIR filter. differentiates filtered results to detect a change in a voltage across the thermistor. detects a negative/positive slope of a voltage change to determine which LED will be turned on/off. executes a software timer, whose time out period is 100ms and it resets every 400ms. the software timer is used to generate a time base for LEDs flashing.

ADC Differential Mode of Operation

To measure a voltage across the thermistor, configure the ADC for a differential mode of operation. In a differential mode, the ADC measures a difference between two analogous inputs. The ADC enables selecting input pairs which are treated as differential inputs.

Detection of a Change of Thermistor Voltage

If a user places a finger on a thermistor, its temperature increases. The temperature rise results in a voltage decrease across the resistor. If the user removes the finger, the temperature decreases and the voltage goes up.

Placing/removing a finger on the thermistor is characterized by a certain slope (rate) of voltage decrease/increase. The application defines positive and negative thresholds for each thermistor. If a difference output exceeds threshold limits(for at least three consequent samples), an action is taken and a corresponding LED starts to flash.