<?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: 9s12xs ATD setup in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228769#M9339</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SOLVED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It was a minor wiring error.&amp;nbsp; I found an open in the circuit that provided power to Vrh of the ATD.&amp;nbsp; I had checked voltage but probed upstream of this open.&amp;nbsp; Rewired, system works fine, I screamed for a few minutes, and back to work!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Radek, thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And now we know what odd results you get when you do not power the ATD system properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 24 Mar 2013 17:40:14 GMT</pubDate>
    <dc:creator>roberthaines</dc:creator>
    <dc:date>2013-03-24T17:40:14Z</dc:date>
    <item>
      <title>9s12xs ATD setup</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228764#M9334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks in advance for answering what appears to be a basic question:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've had some difficulty setting the ATD pins on my 9s12xs128.&amp;nbsp; My goal is to get all 16 pins set to A/D each to read a separate input.&amp;nbsp; However, after spending days changing one setting at a time, I'm starting to wonder if the chip is bad.&amp;nbsp; So, before I throw this one in the trash, please someone check my settings.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code (all other ATD settings are at their default):&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL1_SMP_DIS&amp;nbsp; = 0;&amp;nbsp;&amp;nbsp; // Discharge the pin prior to a reading&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL1_SRES1&amp;nbsp;&amp;nbsp;&amp;nbsp; = 1;&amp;nbsp;&amp;nbsp; // Sets to 12-bit resolution (default is 10-bit)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL1_SRES0&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL2_AFFC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 1;&amp;nbsp;&amp;nbsp; // Sets to Fast Flag Clear&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL3_DJM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 1;&amp;nbsp;&amp;nbsp; // Right Justified&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL3_S8C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0;&amp;nbsp;&amp;nbsp; // 1 Conversion per sequence&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL3_S4C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL3_S2C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL3_S1C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL4_SMP2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 1;&amp;nbsp;&amp;nbsp; // 24 Clock cycles per scan&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL4_SMP1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL4_SMP0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL4_PRS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 1;&amp;nbsp;&amp;nbsp; // ATDCLK = 20mHz / (2 x (1+1)) = 5mHz [buss is at 20mHz]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL5_SCAN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 1;&amp;nbsp;&amp;nbsp; // Continuously scan&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ATD0CTL5_MULT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 1;&amp;nbsp;&amp;nbsp; // Scan all channels&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, when I put a few volts on any of the pins I get no readings.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've also changed it to 16 conversions per sequence and tested pin ATD0 (I would expect it to read that pin 16 times) and what I get is registers ATD0DR0 through ATD0DR5 at 0000, ATD0DR6 and ATD0DR7 with a value that I can change switching the input voltage on and off (and the values do not match the voltage ratio), and ATD0DR8 through ATD0DR15 at 4095.&amp;nbsp; This at least lets me know that physically have it connected, but the results are confusing.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, if anyone has a simple C program I could load in CodeWarrior just to setup and test the ATD system, I would be happy to try it.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help and Thanks!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adapt9s12sx breakout board from Technological Arts.&lt;/P&gt;&lt;P&gt;CodeWarrior 5.9.0&lt;/P&gt;&lt;P&gt;Connected by USB through a USBDM / TBDML&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Mar 2013 22:47:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228764#M9334</guid>
      <dc:creator>roberthaines</dc:creator>
      <dc:date>2013-03-17T22:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: 9s12xs ATD setup</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228765#M9335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In attachmen you can find simple example code for ATD module in multichannel mode. Note: example code was created for S12XEP100, but ATD module is the same as for S12XS and therefore code should be fully compatible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Few notes:&lt;/P&gt;&lt;P&gt;You settings refers to continously scan of ATD channel 0.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Any write to ATD0CTL5 starts new conversion.&lt;/P&gt;&lt;P&gt;If FIFO=0, results of sequence always starts from ATD0DR0 register (even if we measure for example channel 8).&lt;/P&gt;&lt;P&gt;ATD module could be configure for two types of sequences: one sample at multiple channels or multiple samples at one channel. Unfortunately combination is not possible.&lt;/P&gt;&lt;P&gt;If you will need any diffrent ATD example code (like interrupt, external trigger,...), please let me know.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Mar 2013 15:17:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228765#M9335</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2013-03-19T15:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: 9s12xs ATD setup</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228766#M9336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Radek,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the reply and the code, but the 9s12 is still not working.&amp;nbsp; Here's what I did...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I opened CodeWarrior, started a new project for my 9s12 version, copied the Main code from the example into the new Main, and sent it to the chip:&amp;nbsp; I got no response from ATD0 pin (I don't have any of the other pins connected). &lt;/LI&gt;&lt;LI&gt;I modified the code from 8 to all 16 pins by simply adding additional variables and changing from 8 to 16 conversions:&amp;nbsp; I got similar response described in my first post (the first six registers are empty, seven and eight show a change, the last eight registers show maximum value). &lt;/LI&gt;&lt;LI&gt;I changed the clock speeds for a 1 MHz ATD clock:&amp;nbsp; no change.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unless the behavior detailed above describes a commonly incorrect setting, I'm considering that the ATD system on chip is simply not functional.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Mar 2013 00:05:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228766#M9336</guid>
      <dc:creator>roberthaines</dc:creator>
      <dc:date>2013-03-20T00:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: 9s12xs ATD setup</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228767#M9337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately I don’t have any idea what could be wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suppose that you using internal 4MHz crystal. In that case bus clock (without PLL) is 2MHz. ATD0CTL4_PRS should be set to 0x00 for 1MHz ATD clock.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please describe source of your voltage? It is just simply voltage source (like 2.5V), or some potentiometer? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unconnected PAD pins could results any value, but typically result is 0x00 (there depends on leakage current,…).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From AD9S12XS schematic - AN0 is routed to pin 22 at H1 primary I/O connector.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ATD0DR0L register is at address 0x02D1.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Mar 2013 16:27:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228767#M9337</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2013-03-21T16:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: 9s12xs ATD setup</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228768#M9338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Radek,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried different speeds of the ATD clock, but all within the range detailed on the specification sheet.&amp;nbsp; This made no difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got the pin routed properly and am looking at all of the memory addresses for the ATD registers.&amp;nbsp; This is why the results are confusing.&amp;nbsp; It would appear that there is something wrong with the Mode and Timing Control or the Successive Approximation Register of the ATD system.&amp;nbsp; Of course I'm just guessing based on the odd results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The voltage source has been a 1.5 volt battery or a combination to provide up to 4.5 volts.&amp;nbsp; No change in the odd results.&amp;nbsp; I do notice some flicker on open pins, usually just above 0x00.&amp;nbsp; This is not the problem I'm seeing.&amp;nbsp; And speaking of voltage, I do have the Vrh and Vrl connected to +5 and ground.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, the chip appears to be the problem, not the settings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Mar 2013 17:07:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228768#M9338</guid>
      <dc:creator>roberthaines</dc:creator>
      <dc:date>2013-03-24T17:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: 9s12xs ATD setup</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228769#M9339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SOLVED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It was a minor wiring error.&amp;nbsp; I found an open in the circuit that provided power to Vrh of the ATD.&amp;nbsp; I had checked voltage but probed upstream of this open.&amp;nbsp; Rewired, system works fine, I screamed for a few minutes, and back to work!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Radek, thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And now we know what odd results you get when you do not power the ATD system properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Mar 2013 17:40:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9s12xs-ATD-setup/m-p/228769#M9339</guid>
      <dc:creator>roberthaines</dc:creator>
      <dc:date>2013-03-24T17:40:14Z</dc:date>
    </item>
  </channel>
</rss>

