MKMxxZxxACxx5 Bare Metal Software Drivers  R4.1.6
Reference Manual
ADC Example

This example shows typical use of the Analog-to-Digital Converter (ADC) in 16-bit, software triggered single and polled conversion mode with hardware average function. The ADC measures analogue voltage on the AD10 input channel - on the TWR-KM34Z75M board, the AD10 input channel is connected to a 5K potentiometer (R20).

Source code:
/******************************************************************************
* (c) Copyright 2010-2015, Freescale Semiconductor Inc.
* ALL RIGHTS RESERVED.
******************************************************************************
* adc_test.c
******************************************************************************/
#include "drivers.h"
static volatile uint16 tmp16;
void main (void)
{
PRI_LVL0, NULL);
while (1)
{
if (ADC_Ready(CHA))
{
tmp16 = ADC_Read(CHA);
}
}
}
Toolchain support:
IAR EWARM 7.40.7CodeWarrior 10.6KEIL uVision 5.15CrossWorks 3.6ATOLLIC TrueStudio 5.3.0Kinetis Design Studio 3.0.0