<?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: Timer capture examples for LPC4337 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Timer-capture-examples-for-LPC4337/m-p/678778#M27290</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Yuanbin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please refer to this post:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/436270"&gt;Configure lpc4337 timer0 as input capture&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&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>Fri, 09 Jun 2017 05:25:51 GMT</pubDate>
    <dc:creator>kerryzhou</dc:creator>
    <dc:date>2017-06-09T05:25:51Z</dc:date>
    <item>
      <title>Timer capture examples for LPC4337</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Timer-capture-examples-for-LPC4337/m-p/678777#M27289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anyone can provide examples on how to use timer capture function on LPCXpresso 4337 platform? I cannot find any examples on lpc open library.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2017 06:11:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Timer-capture-examples-for-LPC4337/m-p/678777#M27289</guid>
      <dc:creator>yuanbinzhou</dc:creator>
      <dc:date>2017-06-08T06:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: Timer capture examples for LPC4337</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Timer-capture-examples-for-LPC4337/m-p/678778#M27290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Yuanbin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please refer to this post:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/436270"&gt;Configure lpc4337 timer0 as input capture&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&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>Fri, 09 Jun 2017 05:25:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Timer-capture-examples-for-LPC4337/m-p/678778#M27290</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2017-06-09T05:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Timer capture examples for LPC4337</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Timer-capture-examples-for-LPC4337/m-p/678779#M27291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kerry Zhou,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply. I have carefully read the link you have send me and I am currently using the code similar to what you have send.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;#include "board.h"&lt;BR /&gt; #include &amp;lt;stdio.h&amp;gt;&lt;/P&gt;&lt;P&gt;/*****************************************************************************&lt;BR /&gt; * Private types/enumerations/variables&lt;BR /&gt; ****************************************************************************/&lt;/P&gt;&lt;P&gt;#define TIMER_NUMBER 0&lt;BR /&gt; #define CAP_NUMB 0&lt;/P&gt;&lt;P&gt;#define LPC_TIMER LPC_TIMER0&lt;BR /&gt; #define RGU_TIMER_RST RGU_TIMER0_RST&lt;BR /&gt; #define LPC_TIMER_IRQ TIMER0_IRQn&lt;BR /&gt; #define LPC_TIMER_IRQH TIMER0_IRQHandler&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 32-bit timer&lt;BR /&gt; * @return Nothing&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;void LPC_TIMER_IRQH (void)&lt;BR /&gt; {&lt;BR /&gt; static uint32_t times = 0;&lt;BR /&gt; volatile static uint32_t captureValue = 0;&lt;BR /&gt; /* Count how many times the interrupt has being trigger */&lt;BR /&gt; times++;&lt;BR /&gt; if(Chip_TIMER_CapturePending(LPC_TIMER,CAP_NUMB))&lt;BR /&gt; {&lt;BR /&gt; /* Get capture value on CAP0 */&lt;BR /&gt; captureValue = Chip_TIMER_ReadCapture(LPC_TIMER, CAP_NUMB);&lt;BR /&gt; if(times % 0x64 == 0){&lt;BR /&gt; DEBUGOUT(" times:%d\r\n", times);&lt;BR /&gt; DEBUGOUT(" captureValue:%d\r\n", captureValue);&lt;BR /&gt; }&lt;BR /&gt; Chip_TIMER_ClearCapture(LPC_TIMER, CAP_NUMB);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt; * @brief main routine for blinky example&lt;BR /&gt; * @return Function should not exit.&lt;BR /&gt; */&lt;BR /&gt; int main(void)&lt;BR /&gt; {&lt;/P&gt;&lt;P&gt;SystemCoreClockUpdate();&lt;BR /&gt; Board_Init();&lt;BR /&gt; DEBUGOUT("Hello World\n");&lt;/P&gt;&lt;P&gt;/* P1_13 as T0_CAP0, disable internal filter and enable input buffer */&lt;BR /&gt; //Chip_SCU_PinMuxSet(1, 13, (SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC4));&lt;BR /&gt; Chip_SCU_PinMux(1,13, MD_PLN_FAST, SCU_MODE_FUNC4);&lt;BR /&gt; /* Timer 0 CAP0 EDGE enabled and SELECT as 0x2 */&lt;BR /&gt; LPC_GIMA-&amp;gt;CAP0_IN[TIMER_NUMBER][CAP_NUMB] = (1 &amp;lt;&amp;lt; 2) | (2 &amp;lt;&amp;lt; 4) | (1 &amp;lt;&amp;lt; 1);&lt;/P&gt;&lt;P&gt;/* Timer0 init */&lt;BR /&gt; Chip_TIMER_Init(LPC_TIMER);&lt;BR /&gt; /* Reset timer0 */&lt;BR /&gt; Chip_RGU_TriggerReset(RGU_TIMER_RST);&lt;BR /&gt; while (Chip_RGU_InReset(RGU_TIMER_RST));&lt;/P&gt;&lt;P&gt;Chip_TIMER_Reset(LPC_TIMER);&lt;BR /&gt; /* Select PCLK as timer source */&lt;BR /&gt; //Chip_TIMER_TIMER_SetCountClockSrc(LPC_TIMER, TIMER_CAPSRC_RISING_PCLK, CAP_NUMB);&lt;BR /&gt; Chip_TIMER_TIMER_SetCountClockSrc(LPC_TIMER, TIMER_CAPSRC_RISING_CAPN, CAP_NUMB);&lt;BR /&gt; /* Select prescaler value */&lt;BR /&gt; Chip_TIMER_PrescaleSet(LPC_TIMER, 10);&lt;/P&gt;&lt;P&gt;/* Clear capture value on T0.CAP0 */&lt;BR /&gt; Chip_TIMER_ClearCapture(LPC_TIMER, CAP_NUMB);&lt;BR /&gt; /* Enable rising trigger on T0.CAP0 */&lt;BR /&gt; Chip_TIMER_CaptureRisingEdgeEnable(LPC_TIMER, CAP_NUMB);&lt;/P&gt;&lt;P&gt;/* Enable interrupt */&lt;BR /&gt; Chip_TIMER_CaptureEnableInt(LPC_TIMER, CAP_NUMB);&lt;/P&gt;&lt;P&gt;/* Enable timer interrupt */&lt;BR /&gt; NVIC_ClearPendingIRQ(LPC_TIMER_IRQ);&lt;BR /&gt; NVIC_EnableIRQ(LPC_TIMER_IRQ);&lt;/P&gt;&lt;P&gt;/* Enable timer */&lt;BR /&gt; Chip_TIMER_Enable(LPC_TIMER);&lt;BR /&gt; while (1) {&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt; return 0;&lt;BR /&gt; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;In the function "LPC_TIMER_IRQH", I can succeed in printing the "times" value, which is the count of my input signal. However, when using "Chip_TIMER_ReadCapture", the return values always equals to 0. How can I solve it. I think what I have setting in the code is confronted with the data sheet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jun 2017 05:53:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Timer-capture-examples-for-LPC4337/m-p/678779#M27291</guid>
      <dc:creator>yuanbinzhou</dc:creator>
      <dc:date>2017-06-09T05:53:00Z</dc:date>
    </item>
  </channel>
</rss>

