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
driver_examples/adc16/main.c File Reference
#include <stdio.h>
#include "board.h"
#include "fsl_pmc_hal.h"
#include "fsl_adc16_driver.h"
#include "fsl_debug_console.h"

Macros

#define ADCR_VDD
 These values are used to get the temperature. DO NOT MODIFY The method used in this demo to calculate temperature of chip is mapped to Temperature Sensor for the HCS08 Microcontroller Family document (Document Number: AN3031) More...
 
#define V_BG
 
#define V_TEMP25
 
#define M
 
#define STANDARD_TEMP
 
#define ADC16_INSTANCE
 
#define ADC16_TEMPERATURE_CHN
 
#define ADC16_BANDGAP_CHN
 
#define ADC16_CHN_GROUP
 

Functions

void ADC16_Measure (void)
 Gets current temperature of chip. More...
 
void calibrateParams (void)
 Parameters calibration: VDD and ADCR_TEMP25. More...
 
int32_t get_current_temperature (uint32_t adcValue)
 Calculates the current temperature. More...
 
int main (void)
 Measures internal temperature of chip. More...
 

Variables

uint32_t adcValue
 
uint32_t adcrTemp25
 
uint32_t adcr100m
 
adc16_converter_config_t adcUserConfig
 

Macro Definition Documentation

#define ADC16_BANDGAP_CHN
#define ADC16_CHN_GROUP
#define ADC16_INSTANCE
#define ADC16_TEMPERATURE_CHN
#define ADCR_VDD
#define M
#define STANDARD_TEMP
#define V_BG
#define V_TEMP25

Function Documentation

void ADC16_Measure ( void  )

This function gets convertion value, converted temperature and print them to terminal.

void calibrateParams ( void  )

This function used BANDGAP as reference voltage to measure vdd and calibrate V_TEMP25 with that vdd value.

ADC value of BANDGAP

VDD in mV

ADC value of BANDGAP

VDD in mV

int32_t get_current_temperature ( uint32_t  adcValue)

This funcion calculate temperatue used calibrated value as formula in reference manual.

Parameters
ADCconvered value of temperature.
Returns
current temperature in oC.
int main ( void  )

Function prototype for main function.

This function used the input of user as trigger to start the measurement. When user press any key, the conversion will begin, then print converted value and current temperature of the chip.

Parameters
receiveBuffBuffer used to hold received data

Variable Documentation

uint32_t adcr100m
uint32_t adcrTemp25
adc16_converter_config_t adcUserConfig
uint32_t adcValue