<?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>topic Using Two A/D's  FRDM-K22F in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Using-Two-A-D-s-FRDM-K22F/m-p/737155#M44985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a program using one A/D (i know my question above&amp;nbsp;states 2) and based on whether the A/D value is &amp;lt; 0x7fff (turn Red led on) and if the A/D value is &amp;gt;0x7fff (turn Yellow led on).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now that I'm using two A/D's, I see a pointer is being used for each stored A/D value.&lt;/P&gt;&lt;P&gt;I'm not sure how to read "value[0]" and "value[1]".&amp;nbsp; I will use two leds for "value[0]" result, and another two for "value[1]" result.&amp;nbsp; The Red and Yellow criteria will be the same as above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I commented out my LED-Code so I can step-through the program and observe what happens during the A/D process.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Here's what I observed:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;When I hovered over &lt;EM&gt;'word'&lt;/EM&gt; (in red) the 'value' was 0x0000 which is correct, since&amp;nbsp;I adjusted pot1 so the input pin will read&amp;nbsp;0 volts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Likewise, when I hovered over &lt;EM&gt;'word'&lt;/EM&gt; (in blue) the 'value' was&amp;nbsp;approximately&amp;nbsp;0xffff which is correct, &lt;SPAN&gt;since&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;I adjusted &lt;/SPAN&gt;&lt;SPAN&gt;pot2 so the input pin will read&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;3.3 volts.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/34298iA0A94F0F5FFBD3CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This confirmed to me, that the program I created using two A/D's is working correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Here's my struggle:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'm not clear how to use the result from "value[0]", then light the led that determines if it's less than or greater than 0x7fff.&amp;nbsp; Similarly, the same holds true how to read "value[1]".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is my code for a successful measurement with two A/D channels.&amp;nbsp; You'll notice I have the LED-code commented out that was related to my single channel led test.&amp;nbsp; Of course, the uncommented code does not reflect the single channel A/D I used previously.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/34368i3DE622D44EBC94F5/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;Note:&amp;nbsp; I overlapped (void)AD1_GetValue16(&amp;amp;value[0]) in the screen capture for clarity to the reader.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Also, you will notice, below, in the commented code, how I determined whether the Red or Yellow &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;led should turn on/off based on the A/D measurement.&amp;nbsp; This code did work for the signal A/D &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;measurements.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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/34399iB2D000397C1B7134/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&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 26 Nov 2017 02:41:27 GMT</pubDate>
    <dc:creator>briancavanagh</dc:creator>
    <dc:date>2017-11-26T02:41:27Z</dc:date>
    <item>
      <title>Using Two A/D's  FRDM-K22F</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Using-Two-A-D-s-FRDM-K22F/m-p/737155#M44985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a program using one A/D (i know my question above&amp;nbsp;states 2) and based on whether the A/D value is &amp;lt; 0x7fff (turn Red led on) and if the A/D value is &amp;gt;0x7fff (turn Yellow led on).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now that I'm using two A/D's, I see a pointer is being used for each stored A/D value.&lt;/P&gt;&lt;P&gt;I'm not sure how to read "value[0]" and "value[1]".&amp;nbsp; I will use two leds for "value[0]" result, and another two for "value[1]" result.&amp;nbsp; The Red and Yellow criteria will be the same as above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I commented out my LED-Code so I can step-through the program and observe what happens during the A/D process.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Here's what I observed:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;When I hovered over &lt;EM&gt;'word'&lt;/EM&gt; (in red) the 'value' was 0x0000 which is correct, since&amp;nbsp;I adjusted pot1 so the input pin will read&amp;nbsp;0 volts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Likewise, when I hovered over &lt;EM&gt;'word'&lt;/EM&gt; (in blue) the 'value' was&amp;nbsp;approximately&amp;nbsp;0xffff which is correct, &lt;SPAN&gt;since&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;I adjusted &lt;/SPAN&gt;&lt;SPAN&gt;pot2 so the input pin will read&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;3.3 volts.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/34298iA0A94F0F5FFBD3CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This confirmed to me, that the program I created using two A/D's is working correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Here's my struggle:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'm not clear how to use the result from "value[0]", then light the led that determines if it's less than or greater than 0x7fff.&amp;nbsp; Similarly, the same holds true how to read "value[1]".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is my code for a successful measurement with two A/D channels.&amp;nbsp; You'll notice I have the LED-code commented out that was related to my single channel led test.&amp;nbsp; Of course, the uncommented code does not reflect the single channel A/D I used previously.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/34368i3DE622D44EBC94F5/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;Note:&amp;nbsp; I overlapped (void)AD1_GetValue16(&amp;amp;value[0]) in the screen capture for clarity to the reader.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Also, you will notice, below, in the commented code, how I determined whether the Red or Yellow &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;led should turn on/off based on the A/D measurement.&amp;nbsp; This code did work for the signal A/D &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;measurements.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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/34399iB2D000397C1B7134/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&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2017 02:41:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Using-Two-A-D-s-FRDM-K22F/m-p/737155#M44985</guid>
      <dc:creator>briancavanagh</dc:creator>
      <dc:date>2017-11-26T02:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using Two A/D's  FRDM-K22F</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Using-Two-A-D-s-FRDM-K22F/m-p/737156#M44986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did not analyze all of your code, look for places where an address is being used where a value is needed or the other way around.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that in C for an array 'value' and &amp;amp;value[0] return the same address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if( &amp;amp;value &amp;gt; 0x7FF )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should read:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if( value[0] &amp;gt; 0x7FF )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2017 16:40:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Using-Two-A-D-s-FRDM-K22F/m-p/737156#M44986</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2017-11-26T16:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using Two A/D's  FRDM-K22F</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Using-Two-A-D-s-FRDM-K22F/m-p/737157#M44987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try to test the code below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;word value[AD1_CHANNEL_COUNT];&lt;/P&gt;&lt;P&gt;&amp;nbsp; while(1)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;AD1_Measure(TRUE);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;AD1_GetValue16(value);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(value[0]&amp;gt;0x7ff)Bit1_SetVal(bit1Ptr);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;else Bit1_ClrVal(bit1Ptr);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(value[1]&amp;gt;0x7ff)Bit2_SetVal(bit2Ptr);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;else Bit2_ClrVal(bit2Ptr);&lt;BR /&gt;&amp;nbsp; }&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>Tue, 28 Nov 2017 06:54:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Using-Two-A-D-s-FRDM-K22F/m-p/737157#M44987</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2017-11-28T06:54:18Z</dc:date>
    </item>
  </channel>
</rss>

