<?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>LPC MicrocontrollersのトピックRe: Newbie needs help on triggering ADC from SCT - LPC1549 - LPCExpresso board</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Newbie-needs-help-on-triggering-ADC-from-SCT-LPC1549-LPCExpresso/m-p/513154#M44</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Wed May 18 09:48:20 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;&lt;SPAN&gt;Quote: &lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:colin.burn@trelleborg.com" rel="nofollow noopener noreferrer" target="_blank"&gt;colin.burn@trelleborg.com&lt;/A&gt;&lt;/STRONG&gt;&lt;BR /&gt;Having spent days trying to understand the sample SCT codes...&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Days&amp;nbsp;&amp;nbsp; :quest:&amp;nbsp;&amp;nbsp; You are lost&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;&lt;LI-EMOJI id="lia_face-with-open-mouth" title=":face_with_open_mouth:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;&lt;SPAN&gt;Quote: &lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:colin.burn@trelleborg.com" rel="nofollow noopener noreferrer" target="_blank"&gt;colin.burn@trelleborg.com&lt;/A&gt;&lt;/STRONG&gt;&lt;BR /&gt;Can anyone suggest some simple code to persuade an SCT to trigger the ADC? &lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There's no simple SCT code, SCT code is never simple&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":disappointed_face:"&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This sample below should do what you are trying to do. It's not necessary to enable both interrupts. I've done this here so you can use your oscilloscope...&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;
/*
===============================================================================
 Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : main.c
 Author&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : $(author)
 Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :
 Copyright&amp;nbsp;&amp;nbsp; : $(copyright)
 Description : main definition
===============================================================================
*/

#include "board.h"
#include &amp;lt;cr_section_macros.h&amp;gt;

#define ADC_RATE (8000)

volatile uint32_t sct_counter;//count sct events
volatile uint32_t adc_counter;//count adc events

#ifdef __cplusplus
extern "C" {
#endif

//SCT0 is triggering ADC
void SCT0_IRQHandler(void)
{
 if (LPC_SCT0-&amp;gt;EVFLAG &amp;amp; SCT_EVT_0)
 {
&amp;nbsp; LPC_SCT0-&amp;gt;EVFLAG = SCT_EVT_0;
&amp;nbsp; Board_LED_Toggle(0);
&amp;nbsp; sct_counter++;
 }
}

void ADC0A_IRQHandler(void)
{
uint32_t pending;
/* Get pending interrupts */
pending = Chip_ADC_GetFlags(LPC_ADC0);
/* Sequence A completion interrupt */
if (pending &amp;amp; ADC_FLAGS_SEQA_INT_MASK) {
adc_counter++;
}
Board_LED_Toggle(1);
/* Clear any pending interrupts */
Chip_ADC_ClearFlags(LPC_ADC0, pending);
}
#ifdef __cplusplus
}
#endif

void SCT0_init(void)
{
 Chip_SCT_Init(LPC_SCT0); /* The match/capture REGMODE defaults to match mode */
 Chip_SCT_Config(LPC_SCT0, (SCT_CONFIG_32BIT_COUNTER | SCT_CONFIG_CLKMODE_BUSCLK)); /* Configure the SCT as a 32bit counter using the bus clock */
 Chip_SCT_SetMatchCount(LPC_SCT0, SCT_MATCH_0, (SystemCoreClock/(ADC_RATE*2))-1); /* Set the match count for match register 0 */
 Chip_SCT_SetMatchReload(LPC_SCT0, SCT_MATCH_0,(SystemCoreClock/(ADC_RATE*2))-1); /* Set the match reload value */
 LPC_SCT0-&amp;gt;STATE = 0;
 LPC_SCT0-&amp;gt;EVENT[0].STATE&amp;nbsp; = (SCT_EVT_0);// events
 LPC_SCT0-&amp;gt;EVENT[0].CTRL = (0 &amp;lt;&amp;lt; 0)&amp;nbsp; |&amp;nbsp; // use match register
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (1 &amp;lt;&amp;lt; 12) |&amp;nbsp; // COMBMODE[13:12] = match condition
&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; (1 &amp;lt;&amp;lt; 14) |&amp;nbsp; // STATELD[14]&amp;nbsp;&amp;nbsp; = STATEV is loaded
&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; (0 &amp;lt;&amp;lt; 15);&amp;nbsp;&amp;nbsp; // STATEV[19:15] =
 LPC_SCT0-&amp;gt;LIMIT = (1&amp;lt;&amp;lt;0);//limiting match register

 LPC_SCT0-&amp;gt;OUT[7].SET&amp;nbsp;&amp;nbsp;&amp;nbsp; = (1 &amp;lt;&amp;lt; 0);&amp;nbsp;&amp;nbsp; //set SCT0_OUTn with event
 LPC_SCT0-&amp;gt;OUT[7].CLR&amp;nbsp;&amp;nbsp;&amp;nbsp; = (1 &amp;lt;&amp;lt; 0);&amp;nbsp;&amp;nbsp; //clear SCT0_OUTn with event
 LPC_SCT0-&amp;gt;RES&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = (3 &amp;lt;&amp;lt; (7&amp;lt;&amp;lt;1));&amp;nbsp;&amp;nbsp; //conflict: toggle
 Chip_SCT_EnableEventInt(LPC_SCT0,SCT_EVT_0); /* Enable an Interrupt on the Match Event */
 NVIC_EnableIRQ(SCT0_IRQn);
 Chip_SCT_ClearControl(LPC_SCT0, SCT_CTRL_HALT_L | SCT_CTRL_HALT_H);//and start
}

void ADC_init(void)
{
 //PIN setup
 //set PIO1.0 to ADC0.8
 Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 0, IOCON_MODE_INACT);
 Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_8);
 LPC_IOCON-&amp;gt;PIO[1][0] = IOCON_MODE_INACT;
 /* Setup ADC for 12-bit mode and normal power */
 Chip_ADC_Init(LPC_ADC0, 0);
/* For ADC0, sequencer A will be used without threshold events.
&amp;nbsp;&amp;nbsp; It will be triggered by SCT0 out7 */
 Chip_ADC_SetupSequencer(LPC_ADC0, ADC_SEQA_IDX, (ADC_SEQ_CTRL_CHANSEL(8) |
 ADC0_SEQ_CTRL_HWTRIG_SCT0_OUT7&amp;nbsp; | ADC_SEQ_CTRL_MODE_EOS));
 /* Use higher voltage trim for both ADCs */
 Chip_ADC_SetTrim(LPC_ADC0, ADC_TRIM_VRANGE_HIGHV);
 /* Need to do a calibration after initialization and trim */
 Chip_ADC_StartCalibration(LPC_ADC0);
 while (!(Chip_ADC_IsCalibrationDone(LPC_ADC0))) {}
 /* Setup for maximum ADC clock rate */
 Chip_ADC_SetClockRate(LPC_ADC0, ADC_MAX_SAMPLE_RATE);
 /* Clear all pending interrupts */
 Chip_ADC_ClearFlags(LPC_ADC0, Chip_ADC_GetFlags(LPC_ADC0));
 /* Enable sequence A completion interrupts for ADC0 */
 Chip_ADC_EnableInt(LPC_ADC0, ADC_INTEN_SEQA_ENABLE);
 /* Enable related ADC NVIC interrupts */
 NVIC_EnableIRQ(ADC0_SEQA_IRQn);
 /* Enable sequencers */
 Chip_ADC_EnableSequencer(LPC_ADC0, ADC_SEQA_IDX);
}

int main(void)
{
 SystemCoreClockUpdate();
 Board_Init();
 Board_LED_Set(0, true);
 SCT0_init();
 ADC_init();
 while(1)
 {
 }
 return 0 ;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://https://www.lpcware.com/system/files/main_1.cpp" rel="nofollow noopener noreferrer" target="_blank"&gt;Sample...&lt;/A&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:05:10 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:05:10Z</dc:date>
    <item>
      <title>Newbie needs help on triggering ADC from SCT - LPC1549 - LPCExpresso board</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Newbie-needs-help-on-triggering-ADC-from-SCT-LPC1549-LPCExpresso/m-p/513153#M43</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by colin.burn@trelleborg.com on Wed May 18 04:26:32 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As a hardware engineer in a small company, I'm new to LPCExpresso, new to microcontrollers and new to programming in C. (Cue steep learnings curves!) So please forgive me if I'm asking simplistic questions!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a requirement to digitise telephony at 8kHz sampling rate and direct it through a serial port. Using the pre-installed example code, I've somehow (!) managed to get this working, along with a looped-back serial connection linked to the DAC. So audio in ends up as audio out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My trouble is that the example ADC code uses a slow rate SysTick clock which can't go to 8kHz.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So I want to use one of the SCTs to trigger the ADC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Having spent days trying to understand the sample SCT codes, I've got nowhere.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone suggest some simple code to persuade an SCT to trigger the ADC? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I stress that I'm new to C and therefore struggling to follow the highly nested example code. There seems to be a dislocation between the chip's user manual and the example code which doesn't help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using the LPCExpresso dev board with LPC1549 chip.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW, if anyone running this forum reads this, may I suggest adding a more advanced search factility. The ablity to use logical functions such as AND, OR, NOT in the search would *really" save time.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:05:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Newbie-needs-help-on-triggering-ADC-from-SCT-LPC1549-LPCExpresso/m-p/513153#M43</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie needs help on triggering ADC from SCT - LPC1549 - LPCExpresso board</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Newbie-needs-help-on-triggering-ADC-from-SCT-LPC1549-LPCExpresso/m-p/513154#M44</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Wed May 18 09:48:20 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;&lt;SPAN&gt;Quote: &lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:colin.burn@trelleborg.com" rel="nofollow noopener noreferrer" target="_blank"&gt;colin.burn@trelleborg.com&lt;/A&gt;&lt;/STRONG&gt;&lt;BR /&gt;Having spent days trying to understand the sample SCT codes...&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Days&amp;nbsp;&amp;nbsp; :quest:&amp;nbsp;&amp;nbsp; You are lost&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;&lt;LI-EMOJI id="lia_face-with-open-mouth" title=":face_with_open_mouth:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;&lt;SPAN&gt;Quote: &lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:colin.burn@trelleborg.com" rel="nofollow noopener noreferrer" target="_blank"&gt;colin.burn@trelleborg.com&lt;/A&gt;&lt;/STRONG&gt;&lt;BR /&gt;Can anyone suggest some simple code to persuade an SCT to trigger the ADC? &lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There's no simple SCT code, SCT code is never simple&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":disappointed_face:"&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This sample below should do what you are trying to do. It's not necessary to enable both interrupts. I've done this here so you can use your oscilloscope...&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;
/*
===============================================================================
 Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : main.c
 Author&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : $(author)
 Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :
 Copyright&amp;nbsp;&amp;nbsp; : $(copyright)
 Description : main definition
===============================================================================
*/

#include "board.h"
#include &amp;lt;cr_section_macros.h&amp;gt;

#define ADC_RATE (8000)

volatile uint32_t sct_counter;//count sct events
volatile uint32_t adc_counter;//count adc events

#ifdef __cplusplus
extern "C" {
#endif

//SCT0 is triggering ADC
void SCT0_IRQHandler(void)
{
 if (LPC_SCT0-&amp;gt;EVFLAG &amp;amp; SCT_EVT_0)
 {
&amp;nbsp; LPC_SCT0-&amp;gt;EVFLAG = SCT_EVT_0;
&amp;nbsp; Board_LED_Toggle(0);
&amp;nbsp; sct_counter++;
 }
}

void ADC0A_IRQHandler(void)
{
uint32_t pending;
/* Get pending interrupts */
pending = Chip_ADC_GetFlags(LPC_ADC0);
/* Sequence A completion interrupt */
if (pending &amp;amp; ADC_FLAGS_SEQA_INT_MASK) {
adc_counter++;
}
Board_LED_Toggle(1);
/* Clear any pending interrupts */
Chip_ADC_ClearFlags(LPC_ADC0, pending);
}
#ifdef __cplusplus
}
#endif

void SCT0_init(void)
{
 Chip_SCT_Init(LPC_SCT0); /* The match/capture REGMODE defaults to match mode */
 Chip_SCT_Config(LPC_SCT0, (SCT_CONFIG_32BIT_COUNTER | SCT_CONFIG_CLKMODE_BUSCLK)); /* Configure the SCT as a 32bit counter using the bus clock */
 Chip_SCT_SetMatchCount(LPC_SCT0, SCT_MATCH_0, (SystemCoreClock/(ADC_RATE*2))-1); /* Set the match count for match register 0 */
 Chip_SCT_SetMatchReload(LPC_SCT0, SCT_MATCH_0,(SystemCoreClock/(ADC_RATE*2))-1); /* Set the match reload value */
 LPC_SCT0-&amp;gt;STATE = 0;
 LPC_SCT0-&amp;gt;EVENT[0].STATE&amp;nbsp; = (SCT_EVT_0);// events
 LPC_SCT0-&amp;gt;EVENT[0].CTRL = (0 &amp;lt;&amp;lt; 0)&amp;nbsp; |&amp;nbsp; // use match register
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (1 &amp;lt;&amp;lt; 12) |&amp;nbsp; // COMBMODE[13:12] = match condition
&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; (1 &amp;lt;&amp;lt; 14) |&amp;nbsp; // STATELD[14]&amp;nbsp;&amp;nbsp; = STATEV is loaded
&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; (0 &amp;lt;&amp;lt; 15);&amp;nbsp;&amp;nbsp; // STATEV[19:15] =
 LPC_SCT0-&amp;gt;LIMIT = (1&amp;lt;&amp;lt;0);//limiting match register

 LPC_SCT0-&amp;gt;OUT[7].SET&amp;nbsp;&amp;nbsp;&amp;nbsp; = (1 &amp;lt;&amp;lt; 0);&amp;nbsp;&amp;nbsp; //set SCT0_OUTn with event
 LPC_SCT0-&amp;gt;OUT[7].CLR&amp;nbsp;&amp;nbsp;&amp;nbsp; = (1 &amp;lt;&amp;lt; 0);&amp;nbsp;&amp;nbsp; //clear SCT0_OUTn with event
 LPC_SCT0-&amp;gt;RES&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = (3 &amp;lt;&amp;lt; (7&amp;lt;&amp;lt;1));&amp;nbsp;&amp;nbsp; //conflict: toggle
 Chip_SCT_EnableEventInt(LPC_SCT0,SCT_EVT_0); /* Enable an Interrupt on the Match Event */
 NVIC_EnableIRQ(SCT0_IRQn);
 Chip_SCT_ClearControl(LPC_SCT0, SCT_CTRL_HALT_L | SCT_CTRL_HALT_H);//and start
}

void ADC_init(void)
{
 //PIN setup
 //set PIO1.0 to ADC0.8
 Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 0, IOCON_MODE_INACT);
 Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_8);
 LPC_IOCON-&amp;gt;PIO[1][0] = IOCON_MODE_INACT;
 /* Setup ADC for 12-bit mode and normal power */
 Chip_ADC_Init(LPC_ADC0, 0);
/* For ADC0, sequencer A will be used without threshold events.
&amp;nbsp;&amp;nbsp; It will be triggered by SCT0 out7 */
 Chip_ADC_SetupSequencer(LPC_ADC0, ADC_SEQA_IDX, (ADC_SEQ_CTRL_CHANSEL(8) |
 ADC0_SEQ_CTRL_HWTRIG_SCT0_OUT7&amp;nbsp; | ADC_SEQ_CTRL_MODE_EOS));
 /* Use higher voltage trim for both ADCs */
 Chip_ADC_SetTrim(LPC_ADC0, ADC_TRIM_VRANGE_HIGHV);
 /* Need to do a calibration after initialization and trim */
 Chip_ADC_StartCalibration(LPC_ADC0);
 while (!(Chip_ADC_IsCalibrationDone(LPC_ADC0))) {}
 /* Setup for maximum ADC clock rate */
 Chip_ADC_SetClockRate(LPC_ADC0, ADC_MAX_SAMPLE_RATE);
 /* Clear all pending interrupts */
 Chip_ADC_ClearFlags(LPC_ADC0, Chip_ADC_GetFlags(LPC_ADC0));
 /* Enable sequence A completion interrupts for ADC0 */
 Chip_ADC_EnableInt(LPC_ADC0, ADC_INTEN_SEQA_ENABLE);
 /* Enable related ADC NVIC interrupts */
 NVIC_EnableIRQ(ADC0_SEQA_IRQn);
 /* Enable sequencers */
 Chip_ADC_EnableSequencer(LPC_ADC0, ADC_SEQA_IDX);
}

int main(void)
{
 SystemCoreClockUpdate();
 Board_Init();
 Board_LED_Set(0, true);
 SCT0_init();
 ADC_init();
 while(1)
 {
 }
 return 0 ;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://https://www.lpcware.com/system/files/main_1.cpp" rel="nofollow noopener noreferrer" target="_blank"&gt;Sample...&lt;/A&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:05:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Newbie-needs-help-on-triggering-ADC-from-SCT-LPC1549-LPCExpresso/m-p/513154#M44</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie needs help on triggering ADC from SCT - LPC1549 - LPCExpresso board</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Newbie-needs-help-on-triggering-ADC-from-SCT-LPC1549-LPCExpresso/m-p/513155#M45</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:11:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Newbie-needs-help-on-triggering-ADC-from-SCT-LPC1549-LPCExpresso/m-p/513155#M45</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-19T01:11:20Z</dc:date>
    </item>
  </channel>
</rss>

