<?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 56F8367 CW8.0 ADC Calibration does not work in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158480#M2528</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;I'm trying to use the calibration code that is given in the peripheral user manual on page 71-74.&lt;/DIV&gt;&lt;DIV&gt;First I don't know how I'm supposed to insert the data sheet values into the code (CF1= 0,002289 and CF2 = -25.6).&lt;/DIV&gt;&lt;DIV&gt;And if I test the calibration without using both correction factors&amp;nbsp;I get a totally wrong value. Is there some code available that actually works?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Oct 2007 18:49:52 GMT</pubDate>
    <dc:creator>forkstapler</dc:creator>
    <dc:date>2007-10-25T18:49:52Z</dc:date>
    <item>
      <title>56F8367 CW8.0 ADC Calibration does not work</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158480#M2528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;I'm trying to use the calibration code that is given in the peripheral user manual on page 71-74.&lt;/DIV&gt;&lt;DIV&gt;First I don't know how I'm supposed to insert the data sheet values into the code (CF1= 0,002289 and CF2 = -25.6).&lt;/DIV&gt;&lt;DIV&gt;And if I test the calibration without using both correction factors&amp;nbsp;I get a totally wrong value. Is there some code available that actually works?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2007 18:49:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158480#M2528</guid>
      <dc:creator>forkstapler</dc:creator>
      <dc:date>2007-10-25T18:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: 56F8367 CW8.0 ADC Calibration does not work</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158481#M2529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Sorry for the delay.&lt;/DIV&gt;&lt;DIV&gt;Can I propose you to log&amp;nbsp;this issue directly in the Technical support system.&lt;BR /&gt;Please use Freescale on line support web page.&lt;BR /&gt;&amp;nbsp; - Go to following URL: &lt;A href="http://www.freescale.com/TechSupport" rel="nofollow" target="_blank"&gt;http://www.freescale.com/TechSupport&lt;/A&gt;&lt;BR /&gt;&amp;nbsp; - Click on Submit a Service Request. You will come to a login page.&lt;BR /&gt;&amp;nbsp; - You can submit your request through the web from there.&lt;/DIV&gt;&lt;DIV&gt;Please provide us more details about the Tool version used.&lt;BR /&gt;To do that you must:&lt;BR /&gt;* CW:&lt;BR /&gt;Start the IDE and click on Help | About Metrowerks CodeWarrior.&lt;BR /&gt;Click on Installed Products&amp;nbsp;&lt;BR /&gt;Provide us all info displayed.&lt;BR /&gt;Or you can save them in a txt file.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Pascal&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2007 16:49:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158481#M2529</guid>
      <dc:creator>trytohelp</dc:creator>
      <dc:date>2007-11-14T16:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: 56F8367 CW8.0 ADC Calibration does not work</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158482#M2530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi, I am trying to calibrate the ADC's too and I think there could be some mistakes in the Peripheral User Manual.&lt;BR /&gt;In the figure 2.13 (page 73) I think it must appear:&lt;BR /&gt;cal_b_0 = Ya - (UInt16) (( (UInt32) cal_m_0 * (UInt32) Xa_ADC0 ) &amp;gt;&amp;gt; 14 );&lt;BR /&gt;instead of:&lt;BR /&gt;cal_b_0 = Ya - (UInt16) (( (UInt32) cal_m_0 * (UInt32) Xa_ADC0 ) &amp;gt;&amp;gt; 15 );&lt;BR /&gt;and:&lt;BR /&gt;cal_b_1 = Ya - (UInt16) (( (UInt32) cal_m_1 * (UInt32) Xa_ADC1 ) &amp;gt;&amp;gt; 14 );&lt;BR /&gt;instead of:&lt;BR /&gt;cal_b_1 = Ya - (UInt16) (( (UInt32) cal_m_1 * (UInt32) Xa_ADC1 ) &amp;gt;&amp;gt; 15 );&lt;/DIV&gt;&lt;DIV&gt;That is because the maximum value for cal_m_0 and cal_m_1 is 2^15, but they represent m/2 in both cases.&lt;/DIV&gt;&lt;DIV&gt;Then, in figure 2.14 (pag 74), it must appear:&lt;BR /&gt;ADC_Val_2 = ADC_Val_1 + cal_b_0;&lt;BR /&gt;instead of:&lt;BR /&gt;ADC_Val_2 = ( ADC_Val_1 + cal_b_0 ) &amp;lt;&amp;lt; 1;&lt;/DIV&gt;&lt;DIV&gt;Is this correct??&lt;/DIV&gt;&lt;DIV&gt;I have another question:&lt;BR /&gt;I suppose we must consider CF1_CORRECTION as FRAC16(0.002289/2):&lt;BR /&gt;#define CF1_CORRECTION FRAC16(0.002289/2)&lt;BR /&gt;but how we must consider CF2_CORRECTION?? Is the following sentence correct??&lt;BR /&gt;#define CF2_CORRECTION ((Int16)(-25.6 * 8))&lt;BR /&gt;Thank you very much in advance.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2007 00:37:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158482#M2530</guid>
      <dc:creator>rceit</dc:creator>
      <dc:date>2007-11-22T00:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: 56F8367 CW8.0 ADC Calibration does not work</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158483#M2531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Your request requires some investigation.&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;Can I propose you to log&amp;nbsp;this issue directly in the Technical support system ?&lt;BR /&gt;Please use Freescale on line support web page.&lt;BR /&gt;&amp;nbsp; - Go to following URL: &lt;A href="http://www.freescale.com/TechSupport" rel="nofollow" target="_blank"&gt;&lt;FONT color="#017BBA"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://www.freescale.com/TechSupport" target="test_blank"&gt;http://www.freescale.com/TechSupport&lt;/A&gt;&lt;BR /&gt;&amp;nbsp; - Click on Submit a Service Request. You will come to a login page.&lt;BR /&gt;&amp;nbsp; - You can submit your request through the web from there.&lt;/DIV&gt;&lt;DIV&gt;Please provide us more details about the Tool version used.&lt;BR /&gt;To do that you must:&lt;BR /&gt;* CW:&lt;BR /&gt;Start the IDE and click on Help | About Metrowerks CodeWarrior.&lt;BR /&gt;Click on Installed Products&amp;nbsp;&lt;BR /&gt;Provide us all info displayed.&lt;BR /&gt;Or you can save them in a txt file.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Pascal&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2007 16:10:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158483#M2531</guid>
      <dc:creator>trytohelp</dc:creator>
      <dc:date>2007-11-22T16:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: 56F8367 CW8.0 ADC Calibration does not work</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158484#M2532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;This is the respònse of technical support about our question:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;Yes, you are right there is a mistake on the manual, unfortunately.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;The error is in evaluating parameter cal_b_0 in line&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;cal_b_0 = Ya - (UInt16) (( (UInt32) cal_m_0 * (UInt32) Xa_ADC0 ) &amp;gt;&amp;gt; 15&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;This equation uses parameter cal_m_0, which is corrected by&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;CF1_CORRECTION parameter.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;So the cal_m_0 and cal_b_0 have to be calculated without correction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;parameters and these use in a final value calculating as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;Y = (cal_m_0 + CF1_CORRETION)*X + (cal_b_0 + CF2_CORRETION).&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;Please refer to my code example below:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;#define Ya (1023 &amp;lt;&amp;lt; 3) // =&amp;nbsp; 8184&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;#define Yb (3071 &amp;lt;&amp;lt; 3) // = 24568&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;#define DATA_SHEET_PARAMETER_CF1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.010380&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;#define DATA_SHEET_PARAMETER_CF2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -31.7&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;//For "m" correction, need fractional representation of data sheet value&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;/ 2&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;#define CF1_CORRECTION (FRAC16(DATA_SHEET_PARAMETER_CF1) * 16384 / 32768 )&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;// For "b" correction, shift data sheet parameter by 3 bits to allign&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;with RESULT reg.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;#define CF2_CORRECTION ( (INT) ( DATA_SHEET_PARAMETER_CF2 * 8 ) )&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;static void CalibrateADC_m_and_b(void)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;{&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Int16 Xa_ADC0, Xb_ADC0, Xa_ADC1, Xb_ADC1;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Xa_ADC0 = low_ADC_cal_0; // =&amp;nbsp; 8304&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Xb_ADC0 = high_ADC_cal_0;// = 24600&amp;nbsp; values measured&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Xa_ADC1 = low_ADC_cal_1; // =&amp;nbsp; 8312&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Xb_ADC1 = high_ADC_cal_1;// = 24576&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cal_m_0 = (UInt16) div_s( ( Yb - Ya) &amp;gt;&amp;gt; 1, ( Xb_ADC0 - Xa_ADC0 ); // = m/2 = 16472&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cal_b_0 = Ya - (UInt16) (( (UInt32) cal_m_0 * (UInt32) Xa_ADC0 )&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;gt;&amp;gt; 14 );&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;// =Ya - m*Xa&amp;nbsp; = (1023*8) - [(m/2 + CF1/2)*8304]/16384 = 8184 -&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;[(16472*8304)/16384] = 8184 - 8348 = -164 //&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;static void CalibrateADCvalue( void )&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;{&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UInt16 ADC_Val_1, ADC_Val_2;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_Val = getReg( ADCA_ADRSLT0 ); // = 9448&amp;nbsp; value measured&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( cal_b_0 ) // Have we done calibration yet?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // First, multiply by m/2, and shift the result to give the&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;correct&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // bus position.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_Val_1 = (UInt16) ( ((UInt32) (cal_m_0 + CF1_CORRECTION) *&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;(UInt32) ADC_Val )&amp;nbsp; &amp;gt;&amp;gt; 14 );&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // = [(m/2 +CF1/2)* X]/16384 = (16472+170) * 9448/16384 = 9597&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Then, add the expected offset.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_Val_2 = ( ADC_Val_1 + cal_b_0 + CF2_CORRECTION ) ; //&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;(9597-164-254) = 9178&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_Val = (word) ADC_Val_2;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color="#000000"&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;SPAN&gt;&lt;FONT color="#000000"&gt;This is the way how to obtain the right calibrated value&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2007 23:48:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158484#M2532</guid>
      <dc:creator>rceit</dc:creator>
      <dc:date>2007-11-23T23:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: 56F8367 CW8.0 ADC Calibration does not work</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158485#M2533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Correction:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT size="2"&gt;#define CF1_CORRECTION ((DATA_SHEET_PARAMETER_CF1 / 2) * 32768 )&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;or&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;#define CF1_CORRECTION (FRAC16(DATA_SHEET_PARAMETER_CF1 / 2))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;both definitions are correct.&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2007 23:59:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/56F8367-CW8-0-ADC-Calibration-does-not-work/m-p/158485#M2533</guid>
      <dc:creator>rceit</dc:creator>
      <dc:date>2007-11-23T23:59:07Z</dc:date>
    </item>
  </channel>
</rss>

