<?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: QD4 ADC problem in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QD4-ADC-problem/m-p/156124#M8952</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;FONT color="#999999"&gt;&lt;FONT color="#333333"&gt;abicash wrote:&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt; &lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT color="#333333"&gt;I have put a resistor divider to simulate this process where the upper arm is a Preset and the lower is a fixed Resistor.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;If the preset and the fixed resistor are of equal values, this means that the input voltage&amp;nbsp; cannot go below approximately Vdd/2 (as determined by component tolerances)&amp;nbsp; Do you actually measure the voltage between the input pin and Vss (ground) using a DVM?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333"&gt;The code jumps to the ADC interrupt routine all the time even if the voltage is 0V.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;How are you achieving this - you cannot use the preset?&amp;nbsp; You would need to apply a direct short circuit between the pin and Vss (across the fixed resistor).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333"&gt;Now when I set the ADCCVL value to 0xFF ,everything is behaving as it should.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;I suspect you would never get an interrupt because the value 0xFF cannot be exceeded by ADCRL register value.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333"&gt;I checked for some values above 0x80 and I found that above 0x88 for ADCCVL, code is waiting for ADC interrupt ,otherwise every step lands in the ADC interrupt routine.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;I assume that the preset is adjusted to give minimum voltage.&amp;nbsp; The component tolerances for the voltage divider might account for the slightly different threshold. &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Feb 2009 21:25:26 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2009-02-25T21:25:26Z</dc:date>
    <item>
      <title>QD4 ADC problem</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QD4-ADC-problem/m-p/156121#M8949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use the AD2 in QD4 as an ADC input.&lt;/P&gt;&lt;P&gt;This is measuring a +5V max signal.I am testing it at 2.5V.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this I wrote this code&lt;/P&gt;&lt;PRE&gt;
void main(void)&amp;nbsp;&amp;nbsp; {&amp;nbsp; ICSTRM = ICSTRM_FLASH;&amp;nbsp; ICSC2 = 0x00;&amp;nbsp; ICSC1 = 0x06;&amp;nbsp; //Wait until output FLL is selected (CLKST=0)&amp;nbsp; while (ICSSC &amp;amp; 0x04)&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; SOPT1_COPE = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp; //disable COP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // set up adc&amp;nbsp; ADCSC1_ADCH = 0x1f; // disables the ADC during config&amp;nbsp; ADCCFG_ADICLK = 0;// bus clk&amp;nbsp;&amp;nbsp; ADCCFG_MODE = 0b00; // conversion mode, 00 = 8 bit, 10 = 10 bit mode&amp;nbsp; ADCCFG_ADLSMP = 1;&amp;nbsp; // sample time, 1 = long sample time&amp;nbsp; ADCCFG_ADIV = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp; // clock divide, 1 = input clock/2&amp;nbsp; ADCCFG_ADLPC = 1;&amp;nbsp; // low power config, 1 = low power&amp;nbsp;&amp;nbsp;&amp;nbsp; ADCSC2_ADTRG = 0;&amp;nbsp;&amp;nbsp; // trigger select, 0 = software trigger&amp;nbsp; ADCSC2_ACFE = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp; // compare function, 1 = enable compare function&amp;nbsp; ADCSC2_ACFGT = 1;&amp;nbsp;&amp;nbsp; // 1 = compare function greater than&amp;nbsp;&amp;nbsp;&amp;nbsp; ADCSC1_ADCO = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp; // enable single conversion, 1 is continuous conversion&amp;nbsp; ADCSC1_AIEN = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp; // enable ADC interrupt&amp;nbsp; APCTL1_ADPC2 = 1;&amp;nbsp;&amp;nbsp; // disable I/O control on pin&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADCCVL = 0x80;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // set a compare value&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PTADD_PTADD0 =&amp;nbsp; 0x01;&amp;nbsp;&amp;nbsp;&amp;nbsp; PTAD_PTAD0 = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //reset LED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADCSC1_ADCH = 0x02;&amp;nbsp;&amp;nbsp; //ADP2 enable&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; EnableInterrupts;&amp;nbsp;&amp;nbsp; // enable interrupts&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADCSC1_COCO = 0;&amp;nbsp;&amp;nbsp; for(;;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp; //__RESET_WATCHDOG();&amp;nbsp; feeds the dog&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } //loop forever&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* please make sure that you never leave this function */&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; }// end main interrupt 19 void ADC_ISR(void)&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PTAD_PTAD0 =1;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADCSC1_ADCH = 0x1f; // disable the ADC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;But even if ADCRL is &amp;lt;0x80, the ADC interrupts,which it should not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to interrupt only on ADCRL&amp;gt;=ADCCVL but this is not happening.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using this on USBSPYDER.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I doing something silly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help...Thanks and Regards &lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank"&gt;&lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:00:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QD4-ADC-problem/m-p/156121#M8949</guid>
      <dc:creator>abicash</dc:creator>
      <dc:date>2020-10-29T09:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: QD4 ADC problem</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QD4-ADC-problem/m-p/156122#M8950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not entirely sure what is causing the problem, but writing 0 to the COCO bit after the first conversion has commenced will abort that conversion, and is totally unnecessary because it has no affect on the state of the COCO flag. Get rid of the line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Within the ISR code, you have not read the value within ADCRL prior to disabling the ADC module.&amp;nbsp; Therefore any read of ADCRL from outside the ISR will not give a valid result.&amp;nbsp; Read ADCRL from within the ISR code, and this action will also clear the COCO flag (although disabling the ADC module will also do this).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some other comments about your code, not related to the current problem.&amp;nbsp; I notice that you tend to write separately to individual bits of a register.&amp;nbsp; While this is less code efficient that writing to all bits simultaneously, in some cases it is not really advisable, even though it may currently work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Registers such as SOPT1 are write once.&amp;nbsp; Therefore, if more than one bit requires changing from its powerup default value, all bits must be simultaneously written.&amp;nbsp; Even though you are currently changing only a single bit, it is good practice to write all bits, to allow for future changes to the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each write of the ADCSC1 register will abort any conversion in progress, and start a new conversion.&amp;nbsp; I assume that writing a single bit anywhere within the register will also do this - probably not what you would intend.&amp;nbsp; The solution is to simultaneously write to all bits to commence a conversion, e.g. &lt;FONT face="courier new,courier"&gt;ADSC1 = 0xA2;&amp;nbsp; // Commence continuous conversion, Ch 2&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would also do the same for ADSC2 and ADCCFG registers, but that is a personal preference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2009 20:01:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QD4-ADC-problem/m-p/156122#M8950</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2009-02-25T20:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: QD4 ADC problem</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QD4-ADC-problem/m-p/156123#M8951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;bigmac wrote:&lt;BR /&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not entirely sure what is causing the problem, but writing 0 to the COCO bit after the first conversion has commenced will abort that conversion, and is totally unnecessary because it has no affect on the state of the COCO flag. Get rid of the line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;Hello Bigmac..glad to see you agaiin &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;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;I had added the COCO line out of desperation and wasn't there earlier.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Within the ISR code, you have not read the value within ADCRL prior to disabling the ADC module.&amp;nbsp; Therefore any read of ADCRL from outside the ISR will not give a valid result.&amp;nbsp; Read ADCRL from within the ISR code, and this action will also clear the COCO flag (although disabling the ADC module will also do this).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;This I have done with no effect.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some other comments about your code, not related to the current problem.&amp;nbsp; I notice that you tend to write separately to individual bits of a register.&amp;nbsp; While this is less code efficient that writing to all bits simultaneously, in some cases it is not really advisable, even though it may currently work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;This is done for trial.So that I don't have to figure out the value all the time.Only changing the concerned bit does it..&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Registers such as SOPT1 are write once.&amp;nbsp; Therefore, if more than one bit requires changing from its powerup default value, all bits must be simultaneously written.&amp;nbsp; Even though you are currently changing only a single bit, it is good practice to write all bits, to allow for future changes to the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each write of the ADCSC1 register will abort any conversion in progress, and start a new conversion.&amp;nbsp; I assume that writing a single bit anywhere within the register will also do this - probably not what you would intend.&amp;nbsp; The solution is to simultaneously write to all bits to commence a conversion, e.g. &lt;FONT face="courier new,courier"&gt;ADSC1 = 0xA2;&amp;nbsp; // Commence continuous conversion, Ch 2&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would also do the same for ADSC2 and ADCCFG registers, but that is a personal preference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;I will incorporate that in final version.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I have put a resistor divider to simulate this process where the upper arm is a Preset and the lower is a fixed Resistor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code jumps to the ADC interrupt routine all the time even if the voltage is 0V.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now when I set the ADCCVL value to 0xFF ,everything is behaving as it should.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked for some values above 0x80 and I found that above 0x88 for ADCCVL, code is waiting for ADC interrupt ,otherwise every step lands in the ADC interrupt routine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What could be this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2009 20:22:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QD4-ADC-problem/m-p/156123#M8951</guid>
      <dc:creator>abicash</dc:creator>
      <dc:date>2009-02-25T20:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: QD4 ADC problem</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QD4-ADC-problem/m-p/156124#M8952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;FONT color="#999999"&gt;&lt;FONT color="#333333"&gt;abicash wrote:&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt; &lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT color="#333333"&gt;I have put a resistor divider to simulate this process where the upper arm is a Preset and the lower is a fixed Resistor.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;If the preset and the fixed resistor are of equal values, this means that the input voltage&amp;nbsp; cannot go below approximately Vdd/2 (as determined by component tolerances)&amp;nbsp; Do you actually measure the voltage between the input pin and Vss (ground) using a DVM?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333"&gt;The code jumps to the ADC interrupt routine all the time even if the voltage is 0V.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;How are you achieving this - you cannot use the preset?&amp;nbsp; You would need to apply a direct short circuit between the pin and Vss (across the fixed resistor).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333"&gt;Now when I set the ADCCVL value to 0xFF ,everything is behaving as it should.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;I suspect you would never get an interrupt because the value 0xFF cannot be exceeded by ADCRL register value.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333"&gt;I checked for some values above 0x80 and I found that above 0x88 for ADCCVL, code is waiting for ADC interrupt ,otherwise every step lands in the ADC interrupt routine.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;I assume that the preset is adjusted to give minimum voltage.&amp;nbsp; The component tolerances for the voltage divider might account for the slightly different threshold. &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2009 21:25:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QD4-ADC-problem/m-p/156124#M8952</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2009-02-25T21:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: QD4 ADC problem</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QD4-ADC-problem/m-p/156125#M8953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;bigmac wrote:&lt;BR /&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;BR /&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;If the preset and the fixed resistor are of equal values, this means that the input voltage&amp;nbsp; cannot go below approximately Vdd/2 (as determined by component tolerances)&amp;nbsp; Do you actually measure the voltage between the input pin and Vss (ground) using a DVM?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Yes it is little less than 2.5V to 5V&amp;nbsp; since the preset is a larger value&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;How are you achieving this - you cannot use the preset?&amp;nbsp; You would need to apply a direct short circuit between the pin and Vss (across the fixed resistor).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Yes i was putting the pin to ground&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333"&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;I suspect you would never get an interrupt because the value 0xFF cannot be exceeded by ADCRL register value.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333"&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;I assume that the preset is adjusted to give minimum voltage.&amp;nbsp; The component tolerances for the voltage divider might account for the slightly different threshold. &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Okay i changed the scheme and now i have a 0v-2.5V sweep....and I can achieve this..so embarrassed for this mistake and thanks as always for pointing that out ..I will check some more and get back if I have any more problems&lt;/P&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks as always &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;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2009 21:52:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QD4-ADC-problem/m-p/156125#M8953</guid>
      <dc:creator>abicash</dc:creator>
      <dc:date>2009-02-25T21:52:23Z</dc:date>
    </item>
  </channel>
</rss>

