<?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: LPC54101 ADC in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54101-ADC/m-p/616743#M24102</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Carl,&lt;/P&gt;&lt;P&gt;I've attached the ADC.c file which is from the LPCOpen 3.3, and in the ADC.c, I configured the P0_29 as the ADC channel 0, it can work well on the LPCxpresso board and please refer to it for details.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Nov 2016 10:11:33 GMT</pubDate>
    <dc:creator>jeremyzhou</dc:creator>
    <dc:date>2016-11-02T10:11:33Z</dc:date>
    <item>
      <title>LPC54101 ADC</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54101-ADC/m-p/616741#M24100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to get the ADC working on the LPC54101 using LPCopen. I have not successfully managed to get the&amp;nbsp;ADC_SEQA_IRQHandler() interrupt to trigger. I can't seem to find where I am going wrong. I have followed all the steps that are required in the user manual and used steps similar to those in the lpcxpresso54102 ADC example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my code so far (i have not edited any of the LPCopen files from&amp;nbsp;v3.03.000):&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;/*&lt;BR /&gt; * @brief LPC5410x ADC example&lt;BR /&gt; *&lt;BR /&gt; * @note&lt;BR /&gt; * Copyright(C) NXP Semiconductors, 2015&lt;BR /&gt; * All rights reserved.&lt;BR /&gt; *&lt;BR /&gt;* /&lt;/P&gt;&lt;P&gt;#include "chip.h"&lt;/P&gt;&lt;P&gt;/*****************************************************************************&lt;BR /&gt; * Private types/enumerations/variables&lt;BR /&gt; ****************************************************************************/&lt;/P&gt;&lt;P&gt;static volatile int ticks;&lt;BR /&gt;static bool sequenceComplete, thresholdCrossed;&lt;/P&gt;&lt;P&gt;#define TICKRATE_HZ (100) /* 100 ticks per second */&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#define BOARD_ADC_CH 0&lt;/P&gt;&lt;P&gt;/*****************************************************************************&lt;BR /&gt; * Public types/enumerations/variables&lt;BR /&gt; ****************************************************************************/&lt;/P&gt;&lt;P&gt;/*****************************************************************************&lt;BR /&gt; * Private functions&lt;BR /&gt; ****************************************************************************/&lt;/P&gt;&lt;P&gt;/*****************************************************************************&lt;BR /&gt; * Public functions&lt;BR /&gt; ****************************************************************************/&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt; * @brief Handle interrupt from SysTick timer&lt;BR /&gt; * @return Nothing&lt;BR /&gt; */&lt;BR /&gt;void SysTick_Handler(void)&lt;BR /&gt;{&lt;BR /&gt; static uint32_t count;&lt;/P&gt;&lt;P&gt;/* Every 1/2 second */&lt;BR /&gt; count++;&lt;BR /&gt; if (count &amp;gt;= (TICKRATE_HZ / 2)) {&lt;BR /&gt; count = 0;&lt;/P&gt;&lt;P&gt;/* Manual start for ADC conversion sequence A */&lt;BR /&gt; Chip_ADC_StartSequencer(LPC_ADC, ADC_SEQA_IDX);&lt;BR /&gt; Chip_GPIO_SetPinToggle(LPC_GPIO, 0, 11);&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* SEQ-A interrupt handler */&lt;BR /&gt;void ADC_SEQA_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt; uint32_t pending;&lt;/P&gt;&lt;P&gt;/* Get pending interrupts */&lt;BR /&gt; pending = Chip_ADC_GetFlags(LPC_ADC);&lt;/P&gt;&lt;P&gt;/* Sequence A completion interrupt */&lt;BR /&gt; if (pending &amp;amp; ADC_FLAGS_SEQA_INT_MASK) {&lt;BR /&gt; sequenceComplete = true;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Clear any pending interrupts */&lt;BR /&gt; Chip_ADC_ClearFlags(LPC_ADC, ADC_FLAGS_SEQA_INT_MASK);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* ADC threashold interrupt handler */&lt;BR /&gt;void ADC_THCMP_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt; uint32_t pending;&lt;/P&gt;&lt;P&gt;/* Get pending interrupts */&lt;BR /&gt; pending = Chip_ADC_GetFlags(LPC_ADC);&lt;/P&gt;&lt;P&gt;/* Threshold crossing interrupt on ADC input channel */&lt;BR /&gt; if (pending &amp;amp; ADC_FLAGS_THCMP_MASK(BOARD_ADC_CH)) {&lt;BR /&gt; thresholdCrossed = true;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Clear any pending interrupts */&lt;BR /&gt; Chip_ADC_ClearFlags(LPC_ADC, ADC_FLAGS_THCMP_MASK(BOARD_ADC_CH));&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* main function (C entry point) */&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt; int loop = 1; /* Prevents unreachable statement warning */&lt;BR /&gt; uint32_t rawSample;&lt;/P&gt;&lt;P&gt;SystemCoreClockUpdate();&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_INPUTMUX);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_IOCON);&lt;BR /&gt; Chip_GPIO_Init(LPC_GPIO);&lt;/P&gt;&lt;P&gt;//LED init&lt;BR /&gt; Chip_GPIO_SetPinDIROutput(LPC_GPIO, 0, 11);&lt;BR /&gt; Chip_GPIO_SetPinState(LPC_GPIO, 0, 11, 0);&lt;/P&gt;&lt;P&gt;/* Setup ADC for 12-bit mode and normal power */&lt;BR /&gt; Chip_ADC_Init(LPC_ADC, (ADC_CR_RESOL(3) | ADC_CR_TSAMP(ADC_TSAMP_7CLK5)));&lt;/P&gt;&lt;P&gt;uint32_t i;&lt;BR /&gt; for( i=0; i&amp;lt;10000000; i++);&lt;/P&gt;&lt;P&gt;/* FIXME: Enable ADC, should be at least 10mS after ADC is powered up */&lt;BR /&gt; LPC_ADC-&amp;gt;STARTUP = 0x1;&lt;BR /&gt; LPC_ADC-&amp;gt;STARTUP = 0x3; /* Dummy calibration */&lt;/P&gt;&lt;P&gt;/* Need to do a calibration after initialization and trim */&lt;BR /&gt; Chip_ADC_Calibration(LPC_ADC);&lt;/P&gt;&lt;P&gt;/* Setup for maximum ADC clock rate using synchronous clocking */&lt;BR /&gt; Chip_ADC_SetClockRate(LPC_ADC, ADC_MAX_SAMPLE_RATE);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; /* Setup sequencer A for ADC channel 0, EOS interrupt */&lt;BR /&gt; /* Setup a sequencer to do the following:&lt;BR /&gt; Perform ADC conversion of ADC channels 0 */&lt;BR /&gt; Chip_ADC_SetupSequencer(LPC_ADC, ADC_SEQA_IDX, (ADC_SEQ_CTRL_CHANSEL(BOARD_ADC_CH)| ADC_SEQ_CTRL_MODE_EOS));&lt;/P&gt;&lt;P&gt;/* ADC input 0 is on PIO0_29 mapped to FUNC0 */&lt;BR /&gt; Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 29, (IOCON_FUNC0 | IOCON_MODE_INACT |&lt;BR /&gt; IOCON_ANALOG_EN));&lt;/P&gt;&lt;P&gt;/* Setup threshold 0 low and high values to about 25% and 75% of max */&lt;BR /&gt; Chip_ADC_SetThrLowValue(LPC_ADC, 0, 0xf50); // ((1 * 0xFFF) / 4));&lt;BR /&gt; Chip_ADC_SetThrHighValue(LPC_ADC, 0, 0xf70);// ((3 * 0xFFF) / 4));&lt;/P&gt;&lt;P&gt;/* Clear all pending interrupts */&lt;BR /&gt; Chip_ADC_ClearFlags(LPC_ADC, Chip_ADC_GetFlags(LPC_ADC));&lt;/P&gt;&lt;P&gt;/* Enable ADC overrun and sequence A completion interrupts */&lt;BR /&gt; Chip_ADC_EnableInt(LPC_ADC, (ADC_INTEN_SEQA_ENABLE | ADC_INTEN_OVRRUN_ENABLE));&lt;/P&gt;&lt;P&gt;/* Use threshold 0 for ADC channel and enable threshold interrupt mode for&lt;BR /&gt; channel as crossing */&lt;BR /&gt; Chip_ADC_SelectTH0Channels(LPC_ADC, ADC_THRSEL_CHAN_SEL_THR1(BOARD_ADC_CH));&lt;BR /&gt; Chip_ADC_SetThresholdInt(LPC_ADC, BOARD_ADC_CH, ADC_INTEN_THCMP_CROSSING);&lt;/P&gt;&lt;P&gt;/* Enable ADC NVIC interrupt */&lt;BR /&gt; NVIC_EnableIRQ(ADC_SEQA_IRQn);&lt;BR /&gt; NVIC_EnableIRQ(ADC_THCMP_IRQn);&lt;/P&gt;&lt;P&gt;/* Enable sequencer */&lt;BR /&gt; Chip_ADC_EnableSequencer(LPC_ADC, ADC_SEQA_IDX);&lt;/P&gt;&lt;P&gt;/* This example uses the periodic sysTick to manually trigger the ADC,&lt;BR /&gt; but a periodic timer can be used in a match configuration to start&lt;BR /&gt; an ADC sequence without software intervention. */&lt;BR /&gt; SysTick_Config(SystemCoreClock / TICKRATE_HZ);&lt;/P&gt;&lt;P&gt;/* Endless loop */&lt;BR /&gt; while (loop) {&lt;BR /&gt; /* Sleep until something happens */&lt;BR /&gt; __WFI();&lt;/P&gt;&lt;P&gt;if (thresholdCrossed) {&lt;BR /&gt; thresholdCrossed = false;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Is a conversion sequence complete? */&lt;BR /&gt; if (sequenceComplete) {&lt;BR /&gt; sequenceComplete = false;&lt;/P&gt;&lt;P&gt;rawSample = Chip_ADC_GetDataReg(LPC_ADC, 0);&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Should not run to here */&lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Oct 2016 12:20:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54101-ADC/m-p/616741#M24100</guid>
      <dc:creator>englemon</dc:creator>
      <dc:date>2016-10-31T12:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54101 ADC</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54101-ADC/m-p/616742#M24101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Carl,&lt;/P&gt;&lt;P&gt;Have a brief look through the demo, I didn't figure out some errors.&lt;/P&gt;&lt;P&gt;I'd like to reply later after I test the code on the board.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Nov 2016 01:45:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54101-ADC/m-p/616742#M24101</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2016-11-01T01:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54101 ADC</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54101-ADC/m-p/616743#M24102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Carl,&lt;/P&gt;&lt;P&gt;I've attached the ADC.c file which is from the LPCOpen 3.3, and in the ADC.c, I configured the P0_29 as the ADC channel 0, it can work well on the LPCxpresso board and please refer to it for details.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Nov 2016 10:11:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54101-ADC/m-p/616743#M24102</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2016-11-02T10:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54101 ADC</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54101-ADC/m-p/616744#M24103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got it working, thanks for the help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2016 04:58:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54101-ADC/m-p/616744#M24103</guid>
      <dc:creator>englemon</dc:creator>
      <dc:date>2016-11-04T04:58:39Z</dc:date>
    </item>
  </channel>
</rss>

