<?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 Re: Analog To Digital Conversion in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Analog-To-Digital-Conversion/m-p/198027#M7352</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ATD1CTL5&amp;nbsp; = 0xAA;&amp;nbsp; /*right justified;analaog channel 10, scan*/&lt;/P&gt;&lt;P&gt;In comment I see channel 10. ATD1CTL5 Cx bits are also set to 10(0xA). I don't have EVB schematics, but please note that PAD10 pin is wired to ATD1 channel 2. If potentiometer is wired to PAD10, then you need to set Cx bits to 2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 May 2010 23:04:53 GMT</pubDate>
    <dc:creator>kef</dc:creator>
    <dc:date>2010-05-06T23:04:53Z</dc:date>
    <item>
      <title>Analog To Digital Conversion</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Analog-To-Digital-Conversion/m-p/198026#M7351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello ,&lt;/P&gt;&lt;P&gt;I have tried analog input programming where the variable&amp;nbsp;potentiometer&amp;nbsp; readings are converted into subsequent voltage levels. I am unable to retrieve the same on the simulator window.. what is wrong with the code? I am using an Evaluation board from Softech&amp;nbsp;on code warrior&amp;nbsp;version 5.0. I am looking forward for&amp;nbsp;the correction of my code&amp;nbsp;aand useful tips to&amp;nbsp;understand and program the ADC of my controller..Here is the code,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include&amp;lt;hidef.h&amp;gt;&lt;BR /&gt;#include&amp;lt;mc9s12xdp512.h&amp;gt;&lt;BR /&gt;#pragma LINK_INFO DERIVATIVE "mc9s12xdp512"&lt;/P&gt;&lt;P&gt;void ATD_init(void);&lt;BR /&gt;void ATD_CONV(void);&lt;/P&gt;&lt;P&gt;unsigned long int voltage;&lt;BR /&gt;unsigned int pot_value, ix;&lt;/P&gt;&lt;P&gt;void main (void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;ATD_init();&lt;BR /&gt;&amp;nbsp;for(;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif"&gt;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;ATD_CONV();&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void ATD_init(void)&lt;BR /&gt;{&lt;BR /&gt;ATD1CTL2&amp;nbsp; = 0x80;&amp;nbsp; /*ATD power up enable*/&lt;BR /&gt;ATD1CTL3&amp;nbsp; = 0x20;&amp;nbsp; /*4 conversions per sequence; conversion in freeze mode*/&lt;BR /&gt;ATD1CTL4&amp;nbsp; = 0x00;&amp;nbsp; /*10-bit resolution;2 convrsn clk periods;prescalar divide by 2*/&lt;BR /&gt;ATD1CTL5&amp;nbsp; = 0xAA;&amp;nbsp; /*right justified;analaog channel 10, scan*/&lt;BR /&gt;ATD_CONV();&lt;BR /&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;void ATD_CONV(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp; pot_value =&amp;nbsp; ATD1DR0;&lt;BR /&gt;&amp;nbsp;voltage&amp;nbsp;&amp;nbsp; =&amp;nbsp; ((long)pot_value*5000)/1024;&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 20:17:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Analog-To-Digital-Conversion/m-p/198026#M7351</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2010-05-06T20:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Analog To Digital Conversion</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Analog-To-Digital-Conversion/m-p/198027#M7352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ATD1CTL5&amp;nbsp; = 0xAA;&amp;nbsp; /*right justified;analaog channel 10, scan*/&lt;/P&gt;&lt;P&gt;In comment I see channel 10. ATD1CTL5 Cx bits are also set to 10(0xA). I don't have EVB schematics, but please note that PAD10 pin is wired to ATD1 channel 2. If potentiometer is wired to PAD10, then you need to set Cx bits to 2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 23:04:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Analog-To-Digital-Conversion/m-p/198027#M7352</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-05-06T23:04:53Z</dc:date>
    </item>
  </channel>
</rss>

