<?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 M52233 ADC in ColdFire/68K Microcontrollers and Processors</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128063#M580</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm fairly new to working with the MCF hardware and I'm having trouble getting the analog to digital conversion to work correctly. I have a function generator sending a sinusoidal wave going into the AN0 pin (pin 10 on the board) and put the grounding probe to the ground on the board. I have written code to write values into nearly every writeable register associated with the ADC and run the program and still don't see results. Any advice as to what I could be doing wrong would be appreciated. If it helps, here is the code I currently have written:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#include "mcf52233_adc.h"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void ADC_config(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// Disables interrupts, sets individual input pins, sets mode to single sequential&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADC_CTRL1 = 0x4000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// Sets conversion clock to one sixth system clock&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADC_CTRL2 = 0x0002;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Disables zero crossing flag&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADC_ADZCC = 0x0000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Set all samples to be taken from AN0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADC_ADLST1 = 0x0000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADC_ADLST2 = 0x0000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Disable AN1 - AN7, enable AN0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADSDIS = 0b11111110;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Set the 'Start' bit&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADC_CTRL1 = MCF_ADC_CTRL1 | MCF_ADC_CTRL1_START0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Wait in this loop for the conversion to complete&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(!(MCF_ADC_ADSTAT &amp;amp; MCF_ADC_ADSTAT_CIP))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;return;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After spinning in the loop for a few seconds in debug mode and checking the MCF_ADC_RSLT0 register as well as the MCF_ADC_ADSTAT register, there is no change. Any help would be appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-SPH&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Mar 2007 09:10:38 GMT</pubDate>
    <dc:creator>hammondsp</dc:creator>
    <dc:date>2007-03-27T09:10:38Z</dc:date>
    <item>
      <title>M52233 ADC</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128063#M580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm fairly new to working with the MCF hardware and I'm having trouble getting the analog to digital conversion to work correctly. I have a function generator sending a sinusoidal wave going into the AN0 pin (pin 10 on the board) and put the grounding probe to the ground on the board. I have written code to write values into nearly every writeable register associated with the ADC and run the program and still don't see results. Any advice as to what I could be doing wrong would be appreciated. If it helps, here is the code I currently have written:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#include "mcf52233_adc.h"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void ADC_config(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// Disables interrupts, sets individual input pins, sets mode to single sequential&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADC_CTRL1 = 0x4000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// Sets conversion clock to one sixth system clock&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADC_CTRL2 = 0x0002;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Disables zero crossing flag&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADC_ADZCC = 0x0000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Set all samples to be taken from AN0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADC_ADLST1 = 0x0000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADC_ADLST2 = 0x0000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Disable AN1 - AN7, enable AN0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADSDIS = 0b11111110;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Set the 'Start' bit&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_ADC_CTRL1 = MCF_ADC_CTRL1 | MCF_ADC_CTRL1_START0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Wait in this loop for the conversion to complete&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(!(MCF_ADC_ADSTAT &amp;amp; MCF_ADC_ADSTAT_CIP))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;return;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After spinning in the loop for a few seconds in debug mode and checking the MCF_ADC_RSLT0 register as well as the MCF_ADC_ADSTAT register, there is no change. Any help would be appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-SPH&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2007 09:10:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128063#M580</guid>
      <dc:creator>hammondsp</dc:creator>
      <dc:date>2007-03-27T09:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: M52233 ADC</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128064#M581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi&lt;BR /&gt;&lt;BR /&gt;Did you remember to configure the Port AN pins for their analog input function, rather than GPIO? You need something like:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;
    MCF_GPIO_PANPAR = MCF_GPIO_PANPAR_PANPAR7 |
                      MCF_GPIO_PANPAR_PANPAR6 |
                      MCF_GPIO_PANPAR_PANPAR5 |
                      MCF_GPIO_PANPAR_PANPAR4 |
                      MCF_GPIO_PANPAR_PANPAR3 |
                      MCF_GPIO_PANPAR_PANPAR2 |
                      MCF_GPIO_PANPAR_PANPAR1 |
                      MCF_GPIO_PANPAR_PANPAR0;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Without this, the analog signals supplied on the pins are never connected to the A/D unit.&lt;BR /&gt;&lt;BR /&gt;Just a thought. Hope this helps&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Simon&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2007 16:22:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128064#M581</guid>
      <dc:creator>SimonMarsden_de</dc:creator>
      <dc:date>2007-03-27T16:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: M52233 ADC</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128065#M582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi SPH&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I don't see that you are powering up the ADC using something like MCF_ADC_POWER &amp;amp;= ~(PD0 | PD1 | PD2).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;As a reference here is set up code to enable scanning of all 8 inputs.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;ADC_CTL2 = SLOWEST_ADC_CLOCK;&lt;/DIV&gt;&lt;DIV&gt;ADC_POWER &amp;amp;= ~(PD0 | PD1 | PD2).&lt;/DIV&gt;&lt;DIV&gt;PANPAR = 0xff;&lt;/DIV&gt;&lt;DIV&gt;ADC_CTRL1 = (ALL_SINGLE_ENDED | ONCE_SEQUENTIAL | START0);&lt;/DIV&gt;&lt;DIV&gt;while (ADC_ADSTAT &amp;amp; (CIP0 | CIP1)) {}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Results available in ADC_ADRSLT0..7&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You should be able to work out the bit defines from their names and the register descriptions. This code has been used in projects running M5223X and M5213 so&amp;nbsp;is a working reference.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Mark Butcher&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="http://www.utasker.com/" rel="nofollow" target="_blank"&gt;www.uTasker.com&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Message Edited by mjbcswitzerland on &lt;SPAN class="date_text"&gt;2007-03-27&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;11:37 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2007 17:36:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128065#M582</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2007-03-27T17:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: M52233 ADC</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128066#M583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks for the help guys. I was unaware the PANPAR needed to be manipulated for the ADC, I'll give it a try and see what happens.&lt;BR /&gt;&lt;BR /&gt;-SPH&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Mar 2007 05:16:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128066#M583</guid>
      <dc:creator>hammondsp</dc:creator>
      <dc:date>2007-03-28T05:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: M52233 ADC</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128067#M584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello Guys,&lt;BR /&gt;&lt;BR /&gt;I'm fairly new to working with the MCF hardware and I am working on M5213EVB. I try to connect a magnetic sensor to ADC module on the board and transmit the digital signal from ZigBee. From the previous messages, I know I have to set up PANPAR register, but according to reference manual, PANPAR register could be setup to use GPIO function and primary function. I don't understand what is primary function?? Are there any other registers I have to set up? DDRAN? CLRAN? I try to use single-ended, sequencial mode of ADC, so it could convert 12 bit in 6 ADC clocks.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jan 2008 22:32:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128067#M584</guid>
      <dc:creator>Beyond</dc:creator>
      <dc:date>2008-01-31T22:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: M52233 ADC</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128068#M585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi Beyond&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;I don't understand what is primary function?? Are there any other registers I have to set up? DDRAN? CLRAN?&lt;BR /&gt;&lt;BR /&gt;The register PANPAR configures between GPIO and primary function for each of the 8 input.&lt;BR /&gt;A '0' means GPIO function (the default setting) and '1' means primary function, in this case the ADC input function.&lt;BR /&gt;&lt;BR /&gt;The other GPIO controls are not important and can be left unmodified.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Mark&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.uTasker.com" rel="nofollow" target="_blank"&gt;www.uTasker.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2008 00:05:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/M52233-ADC/m-p/128068#M585</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2008-02-01T00:05:24Z</dc:date>
    </item>
  </channel>
</rss>

