<?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: LPC1769 - Problem with Reading ADC in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Problem-with-Reading-ADC/m-p/518051#M2471</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would never use a xprintf from within a interrupt service routine. If this xprintf you are using&lt;/P&gt;&lt;P&gt;is from the standard library then you think about writing a mini-printf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are not resetting the NVIC pending bit in the interrupt routine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Jul 2016 10:21:34 GMT</pubDate>
    <dc:creator>rons</dc:creator>
    <dc:date>2016-07-26T10:21:34Z</dc:date>
    <item>
      <title>LPC1769 - Problem with Reading ADC</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Problem-with-Reading-ADC/m-p/518048#M2468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by sukrubahadir on Fri Apr 01 07:34:50 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to interface with lpc1769's adc. I wrote following code and it does not working. I can't find problem. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using AD0.0 pin. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please help me in this issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code : &lt;/SPAN&gt;&lt;BR /&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;

#define CLKDIV 119

/**
 * @brief peripheral configuration
 */
typedef enum {PERIPH_DISABLE = 0, PERIPH_ENABLE = !PERIPH_DISABLE} PERIPH_MODE;
#define PARAM_PERIPHERAL_MODE(periph_mode) ((periph_mode == PERIPH_DISABLE) || (periph_mode == PERIPH_ENABLE))

/**
 * @brief clock config type definition
 */
typedef enum {CLK_4 = 0, CLK, CLK_2, CLK_8} PeripheralClock;
#define PARAM_PERIPHERALCLOCK(State) ((State == CLK_4) || (State == CLK) || (State == CLK_2) || (State == CLK_8))

/**
 * @brief adc mode type definition
 */
typedef enum {POWER_DOWN_MODE = 0, OPERATIONAL_MODE = !POWER_DOWN_MODE} Adc_Mode;
#define PARAM_ADCMODE(mode) ((mode == POWER_DOWN_MODE) || (mode == OPERATIONAL_MODE))

/**
 * @brief adc pin modes
 */
typedef enum {PULLUP = 0, REPEATER, NEITHER_PULLUP_NOR_PULLDOWN, PULLDOWN} Pin_Mode;
#define PARAM_PinMode(mode) ((mode == PULLUP) || (mode == REPEATER) || (mode == NEITHER_PULLUP_NOR_PULLDOWN) || (mode == PULLDOWN))

void ADC_IRQHandler(void){

uint32_t data = (LPC_ADC-&amp;gt;DR[0] &amp;gt;&amp;gt; 4) &amp;amp; 0xFFF;
xprintf("data : %d \r\n", data);

}

void thermoController_adc_init(void){

// System Configuration for usign ADC.
LPC_SYSCTL-&amp;gt;PCLKSEL[0] |= (CLK_8 &amp;lt;&amp;lt; 24);// Clock for adc peripheral is (system clock / 8) ==&amp;gt; 12 MHz
LPC_SYSCTL-&amp;gt;PCONP |= (PERIPH_ENABLE &amp;lt;&amp;lt; 12); // Clock for adc peripheral enabled.

// ADC pin configuration
LPC_IOCON-&amp;gt;PINSEL[1] |= (1 &amp;lt;&amp;lt; 14); // AD0.0 is used as adc input.
LPC_IOCON-&amp;gt;PINMODE[1] |= (NEITHER_PULLUP_NOR_PULLDOWN &amp;lt;&amp;lt; 14); // AD0.0 pin has neither pull-up nor pull-down resistor.

// ADC Control Register Arrangement
uint32_t ControlRegister = 0x01;
ControlRegister |= (OPERATIONAL_MODE &amp;lt;&amp;lt; 21); // PDN bit arrangement.
ControlRegister |= (CLKDIV &amp;lt;&amp;lt; 8); // CLKDIV is 119 for producing clock at 100 kHz for ADC. By using this value one value is taken per 650 us.

LPC_ADC-&amp;gt;CR = ControlRegister; // Update adc control register

// Interrupt Configuration
NVIC-&amp;gt;IP[5] |= (32 &amp;lt;&amp;lt; 19);
NVIC-&amp;gt;ISER[0] |= (1 &amp;lt;&amp;lt; 22);
LPC_ADC-&amp;gt;INTEN |= (1 &amp;lt;&amp;lt; 0);

ControlRegister |= (1 &amp;lt;&amp;lt; 24); // Start Conversion now.

LPC_ADC-&amp;gt;CR = ControlRegister; // Update adc control register for start conversion.

}

&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:30:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Problem-with-Reading-ADC/m-p/518048#M2468</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 - Problem with Reading ADC</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Problem-with-Reading-ADC/m-p/518049#M2469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by thedaz on Thu Apr 07 10:33:38 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;How does the system clock setup look like ? Did you try running this in a debugger ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:30:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Problem-with-Reading-ADC/m-p/518049#M2469</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 - Problem with Reading ADC</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Problem-with-Reading-ADC/m-p/518050#M2470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;bump&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Jun 2016 01:06:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Problem-with-Reading-ADC/m-p/518050#M2470</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-19T01:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 - Problem with Reading ADC</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Problem-with-Reading-ADC/m-p/518051#M2471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would never use a xprintf from within a interrupt service routine. If this xprintf you are using&lt;/P&gt;&lt;P&gt;is from the standard library then you think about writing a mini-printf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are not resetting the NVIC pending bit in the interrupt routine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 10:21:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Problem-with-Reading-ADC/m-p/518051#M2471</guid>
      <dc:creator>rons</dc:creator>
      <dc:date>2016-07-26T10:21:34Z</dc:date>
    </item>
  </channel>
</rss>

