<?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: Setting up the SCT for a simple match timer. in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-up-the-SCT-for-a-simple-match-timer/m-p/1274788#M44962</link>
    <description>&lt;P&gt;Hi, Chris,&lt;/P&gt;
&lt;P&gt;From your code, you enable the SCT_EVT_0&amp;nbsp; to generate interrupt.&lt;/P&gt;
&lt;PRE&gt;Chip_SCT_EnableEventInt(LPC_SCT1, SCT_EVT_0);&lt;/PRE&gt;
&lt;P&gt;But I do not see the code to generate the SCT_EVT_0 event, maybe it is missing. Pls check.&lt;/P&gt;
&lt;P&gt;BTW, I do not see the code to define the modulo value for the counter, do you use the match0 as modulo? if it is the case, you have to use code to the set it as automatic in CONFIG reg or define another event and specify the event in LIMIT register.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
    <pubDate>Tue, 11 May 2021 05:36:38 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2021-05-11T05:36:38Z</dc:date>
    <item>
      <title>Setting up the SCT for a simple match timer.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-up-the-SCT-for-a-simple-match-timer/m-p/1274670#M44959</link>
      <description>&lt;P&gt;I've used up all the "good" timers on my LPC11e68, so I need to set up the SCT to do a simple match for microseconds into the future and trigger an IRQ - no repeating, PWM, output, input, etc. just a match.&lt;/P&gt;&lt;P&gt;The driver code seems to be missing some interfaces, because I can set the match register, and clear the counter, but I never get my interrupt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;static void setup_timer(void)&lt;BR /&gt;{&lt;BR /&gt;Chip_SCT_Init(LPC_SCT1);&lt;BR /&gt;Chip_SCT_Config(LPC_SCT1, SCT_CONFIG_32BIT_COUNTER | SCT_CONFIG_CLKMODE_BUSCLK);&lt;BR /&gt;&lt;BR /&gt;Chip_SCT_SetPrescale(LPC_SCT1, TIMER_MICROSECONDS - 1);&lt;BR /&gt;NVIC_SetPriority(SCT0_1_IRQn, 2);&lt;BR /&gt;NVIC_ClearPendingIRQ(SCT0_1_IRQn);&lt;BR /&gt;NVIC_EnableIRQ(SCT0_1_IRQn);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;static void start_timer(uint32_t match_value)&lt;BR /&gt;{&lt;BR /&gt;Chip_SCT_SetControl(LPC_SCT1, SCT_CTRL_HALT_L);&lt;BR /&gt;Chip_SCT_SetCount(LPC_SCT1, 0); // You can only write the count when the counter is halted.&lt;BR /&gt;Chip_SCT_SetMatchCount(LPC_SCT1, 0, match_value);&lt;BR /&gt;Chip_SCT_EnableEventInt(LPC_SCT1, SCT_EVT_0);&lt;BR /&gt;Chip_SCT_ClearControl(LPC_SCT1, SCT_CTRL_HALT_L);&lt;BR /&gt;Chip_SCT_SetControl(LPC_SCT1, SCT_CTRL_CLRCTR_L);&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 23:54:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-up-the-SCT-for-a-simple-match-timer/m-p/1274670#M44959</guid>
      <dc:creator>chrispflieger</dc:creator>
      <dc:date>2021-05-10T23:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up the SCT for a simple match timer.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-up-the-SCT-for-a-simple-match-timer/m-p/1274788#M44962</link>
      <description>&lt;P&gt;Hi, Chris,&lt;/P&gt;
&lt;P&gt;From your code, you enable the SCT_EVT_0&amp;nbsp; to generate interrupt.&lt;/P&gt;
&lt;PRE&gt;Chip_SCT_EnableEventInt(LPC_SCT1, SCT_EVT_0);&lt;/PRE&gt;
&lt;P&gt;But I do not see the code to generate the SCT_EVT_0 event, maybe it is missing. Pls check.&lt;/P&gt;
&lt;P&gt;BTW, I do not see the code to define the modulo value for the counter, do you use the match0 as modulo? if it is the case, you have to use code to the set it as automatic in CONFIG reg or define another event and specify the event in LIMIT register.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 05:36:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-up-the-SCT-for-a-simple-match-timer/m-p/1274788#M44962</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2021-05-11T05:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up the SCT for a simple match timer.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-up-the-SCT-for-a-simple-match-timer/m-p/1275093#M44971</link>
      <description>&lt;P&gt;Yes, my code (and the lpcOpen code) is missing something - that's my question, "What am I missing?"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure I need a reload or modulo - I really only want this IRQ to fire once, then I'll shut it off till I need it again much later.&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 15:47:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-up-the-SCT-for-a-simple-match-timer/m-p/1275093#M44971</guid>
      <dc:creator>chrispflieger</dc:creator>
      <dc:date>2021-05-11T15:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up the SCT for a simple match timer.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-up-the-SCT-for-a-simple-match-timer/m-p/1275283#M44973</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Pls refer to the an11538.pdf, which discusses the SCT module.&lt;/P&gt;
&lt;P&gt;This is the code to generate interrupt, if you want to just generate one interrupt, you have to disable interrupt in the ISR.&lt;/P&gt;
&lt;P&gt;void SCT_Init(void)&lt;BR /&gt;{&lt;BR /&gt;LPC_SCT-&amp;gt;CONFIG = (1 &amp;lt;&amp;lt; 0) | (1 &amp;lt;&amp;lt; 17); // unified 32-bit timer, auto limit&lt;BR /&gt;LPC_SCT-&amp;gt;MATCHREL[0].U = SystemCoreClock/100; // match 0 @ 100 Hz = 10 msec&lt;BR /&gt;LPC_SCT-&amp;gt;EVENT[0].STATE = 0xFFFFFFFF; // event 0 happens in all states&lt;BR /&gt;LPC_SCT-&amp;gt;EVENT[0].CTRL = (1 &amp;lt;&amp;lt; 12); // match 0 condition only&lt;BR /&gt;LPC_SCT-&amp;gt;EVEN = (1 &amp;lt;&amp;lt; 0); // event 0 generates an interrupt&lt;BR /&gt;NVIC_EnableIRQ(SCT_IRQn); // enable SCTimer/PWM interrupt&lt;BR /&gt;LPC_SCT-&amp;gt;CTRL_U &amp;amp;= ~(1 &amp;lt;&amp;lt; 2); // unhalt by clearing bit 2 of the CTRL&lt;BR /&gt;}&lt;BR /&gt;Fig 2. Code for SCT_repetitive_irq&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Xiangjun Rong&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 02:17:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Setting-up-the-SCT-for-a-simple-match-timer/m-p/1275283#M44973</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2021-05-12T02:17:37Z</dc:date>
    </item>
  </channel>
</rss>

