<?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 LPC11A14 problem with ADC in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11A14-problem-with-ADC/m-p/534627#M10856</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LucaCorradi on Sat Feb 08 18:24:40 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a big problem with lpc11A14 and ADC reading. I try to exlplain it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my peace of code where I'm trying to read something from ADC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;uint16_t dataADC1;

&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 7, IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_MODE_INACT);

&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_CLOCK_SETUP_T adcClockCfg;

&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_ADC_Init(LPC_ADC, &amp;amp;adcClockCfg);
&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_ADC_EnableChannel(LPC_ADC, ADC_CH1, ENABLE);

&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1) {

/* Start A/D conversion */
Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING);

/* Waiting for A/D conversion complete */
while (Chip_ADC_ReadStatus(LPC_ADC, ADC_CH1, ADC_DR_DONE_STAT) != SET);

/* Read ADC value */
Chip_ADC_ReadValue(LPC_ADC, ADC_CH1, &amp;amp;dataADC1);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can see in the variable "dataADC1" only 0 or 1023, in particular 0 for about Vin&amp;lt;1,5Volt and 1023 for about Vin&amp;gt;1,5Volt.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to read the internal temperature sensor, reference voltage and internal voltage core, but ADC read only 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has someone this problem with this microcontroller?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(I'm using the LPCOpen libraries and lpcxpresso development suite (red-code and LPC-Link debugger) Whit debugger I have just check the ADC registers and the values seems correct.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks at all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Luca Corradi from Italy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 19:36:21 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:36:21Z</dc:date>
    <item>
      <title>LPC11A14 problem with ADC</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11A14-problem-with-ADC/m-p/534627#M10856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LucaCorradi on Sat Feb 08 18:24:40 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a big problem with lpc11A14 and ADC reading. I try to exlplain it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my peace of code where I'm trying to read something from ADC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;uint16_t dataADC1;

&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 7, IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_MODE_INACT);

&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_CLOCK_SETUP_T adcClockCfg;

&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_ADC_Init(LPC_ADC, &amp;amp;adcClockCfg);
&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_ADC_EnableChannel(LPC_ADC, ADC_CH1, ENABLE);

&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1) {

/* Start A/D conversion */
Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING);

/* Waiting for A/D conversion complete */
while (Chip_ADC_ReadStatus(LPC_ADC, ADC_CH1, ADC_DR_DONE_STAT) != SET);

/* Read ADC value */
Chip_ADC_ReadValue(LPC_ADC, ADC_CH1, &amp;amp;dataADC1);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can see in the variable "dataADC1" only 0 or 1023, in particular 0 for about Vin&amp;lt;1,5Volt and 1023 for about Vin&amp;gt;1,5Volt.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to read the internal temperature sensor, reference voltage and internal voltage core, but ADC read only 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has someone this problem with this microcontroller?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(I'm using the LPCOpen libraries and lpcxpresso development suite (red-code and LPC-Link debugger) Whit debugger I have just check the ADC registers and the values seems correct.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks at all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Luca Corradi from Italy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:36:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11A14-problem-with-ADC/m-p/534627#M10856</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: LPC11A14 problem with ADC</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11A14-problem-with-ADC/m-p/534628#M10857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by John@MPL on Sun Feb 09 03:58:13 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; I have used 2 channels of ADC simultaneously on the LPC11A14 and have worked OK.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I used the examples form Keil, as I use uVision.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It may be worth checking these examples for any differences.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry cannot be of any more help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;John W. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:36:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11A14-problem-with-ADC/m-p/534628#M10857</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: LPC11A14 problem with ADC</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11A14-problem-with-ADC/m-p/534629#M10858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LucaCorradi on Sun Mar 09 13:28:52 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot! I tried the examples and the adc works correctly, then I checked the lpcopen code. I found the problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I modified this code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;/* Initialize the ADC peripheral and the ADC setup structure to default value */
void Chip_ADC_Init(LPC_ADC_T *pADC, ADC_CLOCK_SETUP_T *ADCSetup)
{
uint8_t div;
uint32_t cr = 0;
uint32_t clk;

Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_ADC_PD);

Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_ADC);

pADC-&amp;gt;INTEN = 0;/* Disable all interrupts */

cr |= ADC_CR_PDN;

ADCSetup-&amp;gt;adcRate = ADC_MAX_SAMPLE_RATE;
ADCSetup-&amp;gt;bitsAccuracy = ADC_10BITS;
clk = 11;

ADCSetup-&amp;gt;burstMode = false;
div = getClkDiv(pADC, false, ADCSetup-&amp;gt;adcRate, clk);
cr |= ADC_CR_CLKDIV(div);
cr |= ADC_CR_BITACC(ADCSetup-&amp;gt;bitsAccuracy);
pADC-&amp;gt;CR = cr;
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;to this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;/* Initialize the ADC peripheral and the ADC setup structure to default value */
void Chip_ADC_Init(LPC_ADC_T *pADC, ADC_CLOCK_SETUP_T *ADCSetup)
{
uint8_t div;
uint32_t cr = 0;
uint32_t clk;

Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_ADC_PD);

Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_ADC);

pADC-&amp;gt;INTEN = 0;/* Disable all interrupts */

&lt;STRONG&gt;//cr |= ADC_CR_PDN;&lt;/STRONG&gt;

ADCSetup-&amp;gt;adcRate = ADC_MAX_SAMPLE_RATE;
ADCSetup-&amp;gt;bitsAccuracy = ADC_10BITS;
clk = 11;

ADCSetup-&amp;gt;burstMode = false;
div = getClkDiv(pADC, false, ADCSetup-&amp;gt;adcRate, clk);
cr |= ADC_CR_CLKDIV(div);
cr |= ADC_CR_BITACC(ADCSetup-&amp;gt;bitsAccuracy);
pADC-&amp;gt;CR = cr;
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"cr |= ADC_CR_PDN;" wrote in a reserved register!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot Jhon&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;&lt;LI-EMOJI id="lia_grinning-face-with-smiling-eyes" title=":grinning_face_with_smiling_eyes:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; !&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Luca &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:36:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11A14-problem-with-ADC/m-p/534629#M10858</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:36:23Z</dc:date>
    </item>
  </channel>
</rss>

