<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Kinetis Software Development Kit中的主题 Re: MKL26Z How can 2 ADC inputs be read using an interrupt?</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860379#M7928</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="padding: 0px;"&gt;I created a new app using the KL26Z SDK, and the problems have changed.&lt;/P&gt;&lt;P style="padding: 0px;"&gt;.&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;The ADC problem occurs with:&lt;/P&gt;&lt;P style="padding: 0px;"&gt;ADC0_SE6b pin 62&amp;nbsp; &amp;nbsp;FRDM dev kit J2-12 is&amp;nbsp;stuck at 0x0FFF&lt;/P&gt;&lt;P style="padding: 0px;"&gt;ADC0_SE7b pin 63&amp;nbsp; &amp;nbsp;FRDM dev kit J2-8 is reading&amp;nbsp;noise about 0x0A00&lt;/P&gt;&lt;P style="padding: 0px;"&gt;ADC0_SE11 pin 45&amp;nbsp; &amp;nbsp;FRDM dev kit J4-10&amp;nbsp;values are not linear&lt;/P&gt;&lt;P style="padding: 0px;"&gt;ADC0_SE3 pin 11&amp;nbsp; &amp;nbsp; FRDM dev kit J4-5 0x0C12&amp;nbsp; at 2.4895 Volts,&amp;nbsp;0x0FF5&amp;nbsp; 3.2911 Volts&lt;/P&gt;&lt;P style="padding: 0px;"&gt;.&lt;/P&gt;&lt;P style="padding: 0px;"&gt;The values returned from&amp;nbsp;&lt;SPAN&gt;ADC0_SE11 are not linear.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;ADC16_DoAutoCalibration() passed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;#define VOLTS_PER_BIT (3.3f / 4096.0f) // Vref / 12 full scale 0x0FFF&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;fComputedVolts = VOLTS_PER_BIT * (float)iAdcValue;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;See values below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;Input&amp;nbsp; &amp;nbsp; ADC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Computed V&lt;BR /&gt;===== ======&amp;nbsp; &amp;nbsp;==========&lt;BR /&gt;3.3 V&amp;nbsp; &amp;nbsp;0x0F17&amp;nbsp; &amp;nbsp;3.1122 V&lt;BR /&gt;3.0 V&amp;nbsp; &amp;nbsp;0x0E19&amp;nbsp; &amp;nbsp;2.9076 V&lt;BR /&gt;2.5 V&amp;nbsp; &amp;nbsp;0x0C04&amp;nbsp; &amp;nbsp;2.4782 V&lt;BR /&gt;2.0 V&amp;nbsp; &amp;nbsp;0x0A01&amp;nbsp; &amp;nbsp;2.0633 V&lt;BR /&gt;1.5 V&amp;nbsp; &amp;nbsp;0x07E0&amp;nbsp; &amp;nbsp;1.6242 V&lt;BR /&gt;1.0 V&amp;nbsp; &amp;nbsp;0x0612&amp;nbsp; &amp;nbsp;1.2520 V&lt;BR /&gt;0.5 V&amp;nbsp; &amp;nbsp;0x0465&amp;nbsp; &amp;nbsp;0.9063 V&lt;BR /&gt;0.0 V&amp;nbsp; &amp;nbsp;0x0387&amp;nbsp; &amp;nbsp;0.7275 V&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;Input is Orange. Computed V is Blue.&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/70298i0C0442EE9290BCF0/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;.&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;STRONG&gt;Is there a known ADC failure problem with the&amp;nbsp;KL16Z SDK?&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;&lt;STRONG&gt;What is up with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;the non-linear ADC readings?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;Bruce&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Apr 2019 18:01:31 GMT</pubDate>
    <dc:creator>bgraham</dc:creator>
    <dc:date>2019-04-03T18:01:31Z</dc:date>
    <item>
      <title>MKL26Z How can 2 ADC inputs be read using an interrupt?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860374#M7923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MCUXpresso IDE v10.2.1 [Build 795] [2018-07-25] &lt;/P&gt;&lt;P&gt;MKL26Z256VLH4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on a Medical device. It needs to read 2 ADC inputs, a battery voltage and temperature.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 2 questions.&lt;/P&gt;&lt;P&gt;1) The ADC &lt;SPAN&gt;channel&amp;nbsp;&lt;/SPAN&gt;are on&amp;nbsp;ADC0_SE11 pin 45, and&amp;nbsp;ADC0_SE6b pin 62.&lt;/P&gt;&lt;P&gt;Are the channel numbers 0x11 and 0x6B?&lt;/P&gt;&lt;P&gt;0x6B is higher then 31, so that does not look correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp;See my attached project. I setup 2 ADCs in interrupt mode, so they use ADC0_IRQHandler().&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Since ADC0_IRQHandler() is shared by the ADC channels, it must be able to determine which ADC channel has caused the interrupt.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How do I set up and use 2 ADCs inputs?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bruce Graham&lt;BR /&gt;Senior Software Engineer&lt;BR /&gt;TechnoSoft Innovations, Inc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2019 21:56:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860374#M7923</guid>
      <dc:creator>bgraham</dc:creator>
      <dc:date>2019-03-14T21:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: MKL26Z How can 2 ADC inputs be read using an interrupt?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860375#M7924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bruce Graham,&lt;/P&gt;&lt;P&gt;1)&lt;/P&gt;&lt;P&gt;Please check the "Table 3-35. ADC0 channel assignment" of &lt;A href="https://www.nxp.com/docs/en/reference-manual/KL26P121M48SF4RM.pdf"&gt;KL26P121M48SF4RM&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="adc16_channel_config_t.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/75266iB08E183C6727C128/image-size/large?v=v2&amp;amp;px=999" role="button" title="adc16_channel_config_t.png" alt="adc16_channel_config_t.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Table 3-35. ADC0 channel assignment.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/75309iD10FCCD75DAC0DCE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Table 3-35. ADC0 channel assignment.png" alt="Table 3-35. ADC0 channel assignment.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;P&gt;You can refer: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-335320"&gt;Using DMA to Emulate ADC Flexible Scan Mode with SDK 2.x&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Mar 2019 07:10:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860375#M7924</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2019-03-15T07:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: MKL26Z How can 2 ADC inputs be read using an interrupt?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860376#M7925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The provided example is for a MCU with a EDMA controller, so the example did not help.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;I created a simple app that polls the ADC value on pin 45 of my MKL16Z256VLH4 board.&lt;/P&gt;&lt;P&gt;The code came from the ADC16 polling example.&lt;/P&gt;&lt;P&gt;See attached.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;I started with a FRDM-KL26Z board, and replace the KL26Z with a KL16Z.&lt;/P&gt;&lt;P&gt;In the code, I set the input to&amp;nbsp;ADC0_SE11 pin 45.&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;When the app runs, the ADC conversion completes, but the ADC value does not change&amp;nbsp;when&amp;nbsp;&lt;SPAN&gt;the voltage on pin 45 changes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The ADC value jumps between 0 and 4, so is it possible that my code is reading the wrong ADC channel?&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Can somebody point out the program with the code?&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bruce&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2019 21:43:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860376#M7925</guid>
      <dc:creator>bgraham</dc:creator>
      <dc:date>2019-04-01T21:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: MKL26Z How can 2 ADC inputs be read using an interrupt?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860377#M7926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would have provided the code, but I don't know to add it. So, I pasted main and support functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bruce&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;BR /&gt;#include &amp;lt;string.h&amp;gt;&lt;BR /&gt;#include "board.h"&lt;BR /&gt;#include "peripherals.h"&lt;BR /&gt;#include "pin_mux.h"&lt;BR /&gt;#include "clock_config.h"&lt;BR /&gt;#include "MKL16Z4.h"&lt;BR /&gt;#include "fsl_debug_console.h"&lt;BR /&gt;/* TODO: insert other include files here. */&lt;BR /&gt;void FloatToStringNew(char *str, float f, char size);&lt;/P&gt;&lt;P&gt;/* TODO: insert other definitions and declarations here. */&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// Table 3-35. ADC0 channel assignment" of KL26P121M48SF4RM&lt;BR /&gt;#define ADC16_CHANNEL_BATT_VOLT 0x11 // ADC0_SE11 pin 45&lt;BR /&gt;//#define ADC16_CHANNEL_BATT_TEMP 0x06 // ADC0_SE6b pin 62&lt;BR /&gt;#define ADC16_CHANNEL_GROUP 0&lt;/P&gt;&lt;P&gt;/* BATT_VOLT&lt;BR /&gt;4.2V full charge&lt;BR /&gt;3.4V low, must charge&lt;BR /&gt;3.3V protection kicks in&lt;/P&gt;&lt;P&gt;Vin 4.2V (Full Charge)&lt;BR /&gt; |&lt;BR /&gt; 10k&lt;BR /&gt; |---- Vout (BATT_VOLT)&lt;BR /&gt; 4.7k&lt;BR /&gt; |&lt;BR /&gt; GND&lt;/P&gt;&lt;P&gt;Vout = (Vin * R2) / (R1 + R2)&lt;BR /&gt;Vout = (Vin * 4700) / (10000 + 4700)&lt;BR /&gt;= 19740 / 14700&lt;BR /&gt;Max BATT_VOLT = 1.34V&lt;BR /&gt;*/&lt;/P&gt;&lt;P&gt;#define VOLTS_PER_BIT (3.3f / 4096.0f) // Vref / 12 full scale 0x0FFF&lt;/P&gt;&lt;P&gt;float ADC_ValueToVoltage(uint16_t iAdcValue)&lt;BR /&gt;{&lt;BR /&gt; float fVolts = VOLTS_PER_BIT * (float)iAdcValue;&lt;/P&gt;&lt;P&gt;return fVolts;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*&lt;BR /&gt; * @brief Application entry point.&lt;BR /&gt; */&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt; adc16_config_t adc16ConfigStruct;&lt;BR /&gt; adc16_channel_config_t adc16ChannelConfigStruct;&lt;/P&gt;&lt;P&gt;/* Init board hardware. */&lt;BR /&gt; BOARD_InitBootPins();&lt;BR /&gt; BOARD_InitBootClocks();&lt;BR /&gt; BOARD_InitBootPeripherals();&lt;BR /&gt; /* Init FSL debug console. */&lt;BR /&gt; BOARD_InitDebugConsole();&lt;/P&gt;&lt;P&gt;PRINTF("Hello World\n");&lt;/P&gt;&lt;P&gt;ADC16_GetDefaultConfig(&amp;amp;adc16ConfigStruct);&lt;BR /&gt; ADC16_Init(ADC0, &amp;amp;adc16ConfigStruct);&lt;/P&gt;&lt;P&gt;PRINTF(" referenceVoltageSource: %d\n", adc16ConfigStruct.referenceVoltageSource);&lt;BR /&gt; PRINTF(" clockSource: %d\n", adc16ConfigStruct.clockSource);&lt;BR /&gt; PRINTF(" enableAsynchronousClock: %d\n", adc16ConfigStruct.enableAsynchronousClock);&lt;BR /&gt; PRINTF(" clockDivider: %d\n", adc16ConfigStruct.clockDivider);&lt;BR /&gt; PRINTF(" resolution: %d\n", adc16ConfigStruct.resolution);&lt;BR /&gt; PRINTF(" longSampleMode: %d\n", adc16ConfigStruct.longSampleMode);&lt;BR /&gt; PRINTF(" enableHighSpeed: %d\n", adc16ConfigStruct.enableHighSpeed);&lt;BR /&gt; PRINTF(" enableLowPower: %d\n", adc16ConfigStruct.enableLowPower);&lt;BR /&gt; PRINTF("enableContinuousConversion: %d\n", adc16ConfigStruct.enableContinuousConversion);&lt;/P&gt;&lt;P&gt;ADC16_EnableHardwareTrigger(ADC0, false);&lt;/P&gt;&lt;P&gt;#if defined(FSL_FEATURE_ADC16_HAS_CALIBRATION) &amp;amp;&amp;amp; FSL_FEATURE_ADC16_HAS_CALIBRATION&lt;BR /&gt; if (kStatus_Success == ADC16_DoAutoCalibration(ADC0))&lt;BR /&gt; {&lt;BR /&gt; PRINTF("ADC16_DoAutoCalibration() Done.\r\n");&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; PRINTF("ADC16_DoAutoCalibration() Failed.\r\n");&lt;BR /&gt; }&lt;BR /&gt; #endif // FSL_FEATURE_ADC16_HAS_CALIBRATION&lt;/P&gt;&lt;P&gt;adc16ChannelConfigStruct.channelNumber = ADC16_CHANNEL_BATT_VOLT;&lt;BR /&gt; adc16ChannelConfigStruct.enableInterruptOnConversionCompleted = false;// Disable the interrupt.&lt;/P&gt;&lt;P&gt;#if defined(FSL_FEATURE_ADC16_HAS_DIFF_MODE) &amp;amp;&amp;amp; FSL_FEATURE_ADC16_HAS_DIFF_MODE&lt;BR /&gt; adc16ChannelConfigStruct.enableDifferentialConversion = false;&lt;BR /&gt; #endif // FSL_FEATURE_ADC16_HAS_DIFF_MODE&lt;/P&gt;&lt;P&gt;while(1)&lt;BR /&gt; {&lt;BR /&gt; //PRINTF("Press any key to get user channel's ADC value ...\r\n");&lt;BR /&gt; //GETCHAR(); // Input any key in terminal console.&lt;/P&gt;&lt;P&gt;ADC16_SetChannelConfig(ADC0, ADC16_CHANNEL_GROUP, &amp;amp;adc16ChannelConfigStruct);&lt;/P&gt;&lt;P&gt;while (kADC16_ChannelConversionDoneFlag != ADC16_GetChannelStatusFlags(ADC0, ADC16_CHANNEL_GROUP))&lt;BR /&gt; {&lt;BR /&gt; }&lt;BR /&gt; uint16_t iValueAdc = ADC16_GetChannelConversionValue(ADC0, ADC16_CHANNEL_GROUP);&lt;BR /&gt; float fBatteryVoltage = ADC_ValueToVoltage(iValueAdc);&lt;BR /&gt;#if 1&lt;BR /&gt; char szBatteryVoltage[32];&lt;BR /&gt; FloatToStringNew(szBatteryVoltage, fBatteryVoltage, 6);&lt;BR /&gt; PRINTF("ADC Value: 0x%04X %s Volts\r\n", iValueAdc, szBatteryVoltage);&lt;BR /&gt;#else&lt;BR /&gt; PRINTF("ADC Value: 0x%04X %f Volts\r\n", iValueAdc, fBatteryVoltage);&lt;BR /&gt;#endif&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#if 1&lt;BR /&gt;// convert float to string one decimal digit at a time&lt;BR /&gt;// assumes float is &amp;lt; 65536 and ARRAYSIZE is big enough&lt;BR /&gt;// problem: it truncates numbers at size without rounding&lt;BR /&gt;// str is a char array to hold the result, float is the number to convert&lt;BR /&gt;// size is the number of decimal digits you want&lt;BR /&gt;void FloatToStringNew(char *str, float f, char size)&lt;BR /&gt;{&lt;BR /&gt; int pos; // position in string&lt;BR /&gt; char len; // length of decimal part of result&lt;BR /&gt; int value; // decimal digit(s) to convert&lt;/P&gt;&lt;P&gt;pos = 0; // initialize pos, just to be sure&lt;/P&gt;&lt;P&gt;value = (int)f; // truncate the floating point number&lt;BR /&gt; itoa(value, str, 10); // this is kinda dangerous depending on the length of str&lt;BR /&gt; // now str array has the digits before the decimal&lt;BR /&gt; strcat(str, ".");&lt;/P&gt;&lt;P&gt;if (f &amp;lt; 0 ) // handle negative numbers&lt;BR /&gt; {&lt;BR /&gt; f *= -1;&lt;BR /&gt; value *= -1;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;len = strlen(str); // find out how big the integer part was&lt;BR /&gt; pos = len; // position the pointer to the end of the integer part&lt;/P&gt;&lt;P&gt;while(pos &amp;lt; size) // process remaining digits&lt;BR /&gt; {&lt;BR /&gt; f = f - (float)value; // hack off the whole part of the number&lt;BR /&gt; f *= 10; // move next digit over&lt;BR /&gt; value = (int)f; // get next digit&lt;BR /&gt; itoa(value, &amp;amp;str[pos], 10); // convert digit to string&lt;BR /&gt; pos++;&lt;BR /&gt; }&lt;BR /&gt; str[pos] = 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#endif&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2019 21:47:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860377#M7926</guid>
      <dc:creator>bgraham</dc:creator>
      <dc:date>2019-04-01T21:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: MKL26Z How can 2 ADC inputs be read using an interrupt?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860378#M7927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The ADC problem occurs with:&lt;/P&gt;&lt;P&gt;ADC0_SE6b pin 62&amp;nbsp; &amp;nbsp;FRDM dev kit J2-12&lt;/P&gt;&lt;P&gt;ADC0_SE7b pin 63&amp;nbsp; &amp;nbsp;FRDM dev kit J2-8&lt;/P&gt;&lt;P&gt;ADC0_SE11 pin 45&amp;nbsp; &amp;nbsp;FRDM dev kit J4-10&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;LIGHT_SNS works:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ADC0_SE3 pin 11&amp;nbsp; &amp;nbsp; FRDM dev kit J4-5.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Why does&amp;nbsp;&lt;SPAN&gt;ADC0_SE3 work, but not&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;ADC0_SE6b,&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;ADC0_SE7b and ADC0_SE11?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Bruce&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2019 23:12:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860378#M7927</guid>
      <dc:creator>bgraham</dc:creator>
      <dc:date>2019-04-01T23:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: MKL26Z How can 2 ADC inputs be read using an interrupt?</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860379#M7928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="padding: 0px;"&gt;I created a new app using the KL26Z SDK, and the problems have changed.&lt;/P&gt;&lt;P style="padding: 0px;"&gt;.&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;The ADC problem occurs with:&lt;/P&gt;&lt;P style="padding: 0px;"&gt;ADC0_SE6b pin 62&amp;nbsp; &amp;nbsp;FRDM dev kit J2-12 is&amp;nbsp;stuck at 0x0FFF&lt;/P&gt;&lt;P style="padding: 0px;"&gt;ADC0_SE7b pin 63&amp;nbsp; &amp;nbsp;FRDM dev kit J2-8 is reading&amp;nbsp;noise about 0x0A00&lt;/P&gt;&lt;P style="padding: 0px;"&gt;ADC0_SE11 pin 45&amp;nbsp; &amp;nbsp;FRDM dev kit J4-10&amp;nbsp;values are not linear&lt;/P&gt;&lt;P style="padding: 0px;"&gt;ADC0_SE3 pin 11&amp;nbsp; &amp;nbsp; FRDM dev kit J4-5 0x0C12&amp;nbsp; at 2.4895 Volts,&amp;nbsp;0x0FF5&amp;nbsp; 3.2911 Volts&lt;/P&gt;&lt;P style="padding: 0px;"&gt;.&lt;/P&gt;&lt;P style="padding: 0px;"&gt;The values returned from&amp;nbsp;&lt;SPAN&gt;ADC0_SE11 are not linear.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;ADC16_DoAutoCalibration() passed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;#define VOLTS_PER_BIT (3.3f / 4096.0f) // Vref / 12 full scale 0x0FFF&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;fComputedVolts = VOLTS_PER_BIT * (float)iAdcValue;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;See values below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;Input&amp;nbsp; &amp;nbsp; ADC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Computed V&lt;BR /&gt;===== ======&amp;nbsp; &amp;nbsp;==========&lt;BR /&gt;3.3 V&amp;nbsp; &amp;nbsp;0x0F17&amp;nbsp; &amp;nbsp;3.1122 V&lt;BR /&gt;3.0 V&amp;nbsp; &amp;nbsp;0x0E19&amp;nbsp; &amp;nbsp;2.9076 V&lt;BR /&gt;2.5 V&amp;nbsp; &amp;nbsp;0x0C04&amp;nbsp; &amp;nbsp;2.4782 V&lt;BR /&gt;2.0 V&amp;nbsp; &amp;nbsp;0x0A01&amp;nbsp; &amp;nbsp;2.0633 V&lt;BR /&gt;1.5 V&amp;nbsp; &amp;nbsp;0x07E0&amp;nbsp; &amp;nbsp;1.6242 V&lt;BR /&gt;1.0 V&amp;nbsp; &amp;nbsp;0x0612&amp;nbsp; &amp;nbsp;1.2520 V&lt;BR /&gt;0.5 V&amp;nbsp; &amp;nbsp;0x0465&amp;nbsp; &amp;nbsp;0.9063 V&lt;BR /&gt;0.0 V&amp;nbsp; &amp;nbsp;0x0387&amp;nbsp; &amp;nbsp;0.7275 V&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;Input is Orange. Computed V is Blue.&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/70298i0C0442EE9290BCF0/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;.&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;STRONG&gt;Is there a known ADC failure problem with the&amp;nbsp;KL16Z SDK?&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;&lt;STRONG&gt;What is up with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;the non-linear ADC readings?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px;"&gt;&lt;SPAN&gt;Bruce&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2019 18:01:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL26Z-How-can-2-ADC-inputs-be-read-using-an-interrupt/m-p/860379#M7928</guid>
      <dc:creator>bgraham</dc:creator>
      <dc:date>2019-04-03T18:01:31Z</dc:date>
    </item>
  </channel>
</rss>

