<?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>S12 / MagniV MicrocontrollersのトピックRe: Problems with ATD ch7 conversion</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183344#M6813</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;To ch7 there is connected the output of a g-sensor(also made by freescale). The sensor is power suplied&amp;nbsp; by the uC's testboard. The only thing missing is a cappacitor which connected between the ground and the sensor's output. But I don't think that could affect the conversion in such an ugly way.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by StefX2 on &lt;SPAN class="date_text"&gt;2008-01-27&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;07:26 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Jan 2008 03:20:00 GMT</pubDate>
    <dc:creator>StefX2</dc:creator>
    <dc:date>2008-01-28T03:20:00Z</dc:date>
    <item>
      <title>Problems with ATD ch7 conversion -  HCS12C32</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183342#M6811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Hello,&lt;BR /&gt;&lt;BR /&gt;I want to make a conversion using the 7th channel but it will not work, please tell me what is wrong. It works fine using ch 0 :&l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bsp;ATDCTL5_CC=1;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;x=ATDDR7H;&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORTB=x; //the LED's from PORTB should start blinking&lt;BR /&gt;&lt;BR /&gt;x- never changes it's value (it is always 0). The same in the the debugger: x=0......&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif"&gt;&lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;If I select channel 0, it works fine, the LED's are blinking..x changes it's value.&lt;BR /&gt;I would use ch0, but it is ocupied by a potentiometer .&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;Added p/n to subject.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by NLFSJ on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-01-29&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;03:31 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Jan 2008 18:44:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183342#M6811</guid>
      <dc:creator>StefX2</dc:creator>
      <dc:date>2008-01-27T18:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ATD ch7 conversion</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183343#M6812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;As the risk of stating the obvious, what is connected to that input?&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Jan 2008 23:00:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183343#M6812</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-01-27T23:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ATD ch7 conversion</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183344#M6813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;To ch7 there is connected the output of a g-sensor(also made by freescale). The sensor is power suplied&amp;nbsp; by the uC's testboard. The only thing missing is a cappacitor which connected between the ground and the sensor's output. But I don't think that could affect the conversion in such an ugly way.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by StefX2 on &lt;SPAN class="date_text"&gt;2008-01-27&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;07:26 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2008 03:20:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183344#M6813</guid>
      <dc:creator>StefX2</dc:creator>
      <dc:date>2008-01-28T03:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ATD ch7 conversion</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183345#M6814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Ok, what processor chip is it?&lt;BR /&gt;&lt;BR /&gt;Are you sure that the sleep pin on the accelerometer chip is pulled high?&lt;BR /&gt;&lt;BR /&gt;Also, &lt;I&gt;create a dummy (test) project&lt;/I&gt; and use Processor Expert to generate some test code.&lt;BR /&gt;&lt;BR /&gt;It can generate an interrupt driven channel scanner that is prettry cool, since you will need to read at least three channels.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2008 03:44:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183345#M6814</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-01-28T03:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ATD ch7 conversion</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183346#M6815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;The chip is an: HCS12C32, on a Softec development board.&lt;BR /&gt;The sensor is working fine. If I use a regular voltmeter I can clearly see it working very fine(with voltage rnaging from 1.5V-3V.&lt;BR /&gt;&lt;BR /&gt;I'll try with the Processor Expert..allthough I never used it &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt; .&lt;BR /&gt;&lt;BR /&gt;The code I have written, does it look OK?&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2008 03:53:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183346#M6815</guid>
      <dc:creator>StefX2</dc:creator>
      <dc:date>2008-01-28T03:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ATD ch7 conversion</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183347#M6816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Well, there are al lot factors, so it would be best if you do it.&lt;BR /&gt;&lt;BR /&gt;You need the interrupt driven mulit-channel set-up any way - you have 3 axis and a pot to read.&lt;BR /&gt;&lt;BR /&gt;Create the test project,&amp;nbsp; then in the bean selector go to CPU Internal Peripherals/Converter/ADC&lt;BR /&gt;There is a control with +/- to add channels.&lt;BR /&gt;Then it is just a matter of fill in the form.&amp;nbsp; Any thing with a red ! needs to be changed.&lt;BR /&gt;Then on the processor expert menu, click generate code.&lt;BR /&gt;There will be a file AD1.c you also need the code in vectors.c. If you already have a vector table, just add the one you need. If not just cut and paste the vectors.&lt;BR /&gt;It's pretty easy, and then when you need other peripherals&amp;nbsp; set up you know how.&lt;BR /&gt;There are three functions you need:&lt;BR /&gt;&lt;BR /&gt;byte AD1_Measure(bool WaitForResult)&amp;nbsp; - Call this to start a mesurement&lt;BR /&gt;byte AD1_GetValue16(word *Values) - Call this with an array the size of the number of channels. It will return 0 when done.&lt;BR /&gt;void AD1_Init(void) - Call this before using&lt;BR /&gt;ISR(AD1_Interrupt) - this is the interrupt vector.&lt;BR /&gt;&lt;BR /&gt;You also need these:&lt;BR /&gt;#define ERR_BUSY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Device is busy. */&lt;BR /&gt;#define ERR_OK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* OK */&lt;BR /&gt;&lt;BR /&gt;I usually also look up the register in the spec to figure out how it is&amp;nbsp; done.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2008 07:29:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183347#M6816</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-01-28T07:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ATD ch7 conversion</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183348#M6817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;Ok..I think I know what I have to do. Thank you a lot!&lt;BR /&gt;&lt;BR /&gt;Stefan&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2008 14:43:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183348#M6817</guid>
      <dc:creator>StefX2</dc:creator>
      <dc:date>2008-01-28T14:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ATD ch7 conversion</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183349#M6818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....I had no success..... &lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" id="smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&amp;nbsp;&amp;nbsp; I have no ideea what the problem might be.&lt;BR /&gt;&lt;BR /&gt;Does anybody have a pice of code(the init. of the ADC) which workes for sure(tested)?&lt;BR /&gt;&lt;BR /&gt;Stefan&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 22:35:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183349#M6818</guid>
      <dc:creator>StefX2</dc:creator>
      <dc:date>2008-01-29T22:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ATD ch7 conversion</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183350#M6819</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;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;&amp;nbsp;This works for sure on a Dx (DP,DG,DT, ect) 256.&lt;BR /&gt;&lt;BR /&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;//===============================================================================// ADC// Dragons have a pot on channel 7. We use// this for controlling the brightness of the 7-seg LEDs.//=============================================================================== // ADC Defines.#define MULTI_MODE    0x10#define SINGLE_MODE   0#define SCAN_MODE     0x20#define NO_SCAN_MODE 0#define POT_CHANNEL_NUM   0x7  // reading input from AN07#define SCF           0x80      //Sequence Complete Flag in ATD0STAT0byte ADTValue;//===============================================================================// Trigger Read, wait, then read a channel and return 8-bit value..//===============================================================================byte ReadADC(byte channel) {  byte status;  // This resets the conversion done flag and starts a new conversion.  ATD0CTL5 = SINGLE_MODE+NO_SCAN_MODE+channel;    for (;;)   {     status = ATD0STAT0;     if( status &amp;amp; SCF )       break;  }    status = ATD0DR7H;     // Just the hi byte. Ignore LSB's  ADTValue = status;    return status; }

// Init code - put in main.
  // ATD block set up.
  ATD0CTL2 = 0x80;      // Enable power up mode for ADC Block
  ATD0CTL3 = 0x40;      // Set 8 bit conversions.
   
  // Set the enable digital input for the switches SW1-SW4
  ATD0DIEN  = 0xff;

&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by JimDon on &lt;SPAN class="date_text"&gt;2008-01-29&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;10:49 AM&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by JimDon on &lt;SPAN class="date_text"&gt;2008-01-29&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;10:50 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:34:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183350#M6819</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2020-10-29T09:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ATD ch7 conversion</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183351#M6820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; It is working! Taking a look at your software helped me find the error in mine.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thank you!&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2008 16:52:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problems-with-ATD-ch7-conversion-HCS12C32/m-p/183351#M6820</guid>
      <dc:creator>StefX2</dc:creator>
      <dc:date>2008-02-06T16:52:38Z</dc:date>
    </item>
  </channel>
</rss>

