<?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>Kinetis MicrocontrollersのトピックRe: measure time using FTM input capture</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/measure-time-using-FTM-input-capture/m-p/702858#M43180</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't describe exactly what *kind* of time you are measuring, but in any case it is FAR better NOT to reset the counter during operation, as you will most likely run into race conditions and/or inconsistent measurements.&amp;nbsp; Let the counter free-run (modulo 65536) and simply use unsigned 16-bit math to calculate elapsed time.&amp;nbsp; I measure time between sequences of rising edges, and each period is simply:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;elapased_u16t = new_timestamp_u16t - old_timestamp_u16t;&amp;nbsp; //timestamps pulled from capture register&lt;/P&gt;&lt;P&gt;The unsigned math will always give the proper difference, even including one rollover.&amp;nbsp; It gets 'messier' if your time period math has to include a timeframe longer than one FTM rollover, as you have to start keeping track of overflow interrupts and THOSE race conditions will give you some headaches...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Sep 2017 21:32:20 GMT</pubDate>
    <dc:creator>egoodii</dc:creator>
    <dc:date>2017-09-13T21:32:20Z</dc:date>
    <item>
      <title>measure time using FTM input capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/measure-time-using-FTM-input-capture/m-p/702857#M43179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using micro kinetis&amp;nbsp;MKE02Z64VLC4 &amp;nbsp;to measure time trougth FTM input capture. Project was initied on process expert.&lt;/P&gt;&lt;P&gt;I need to reset counter in each event and I call&amp;nbsp;&lt;/P&gt;&lt;P&gt;** ===================================================================&lt;BR /&gt;** Method : EncoderA_Reset (component Capture)&lt;BR /&gt;** Description :&lt;BR /&gt;** This method resets the counter register (see implementation&lt;BR /&gt;** note in &amp;lt;General Info&amp;gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But counter is not reset.&lt;/P&gt;&lt;P&gt;Where I can see how I need implement it ??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2017 16:53:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/measure-time-using-FTM-input-capture/m-p/702857#M43179</guid>
      <dc:creator>rodolfocazares</dc:creator>
      <dc:date>2017-09-13T16:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: measure time using FTM input capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/measure-time-using-FTM-input-capture/m-p/702858#M43180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't describe exactly what *kind* of time you are measuring, but in any case it is FAR better NOT to reset the counter during operation, as you will most likely run into race conditions and/or inconsistent measurements.&amp;nbsp; Let the counter free-run (modulo 65536) and simply use unsigned 16-bit math to calculate elapsed time.&amp;nbsp; I measure time between sequences of rising edges, and each period is simply:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;elapased_u16t = new_timestamp_u16t - old_timestamp_u16t;&amp;nbsp; //timestamps pulled from capture register&lt;/P&gt;&lt;P&gt;The unsigned math will always give the proper difference, even including one rollover.&amp;nbsp; It gets 'messier' if your time period math has to include a timeframe longer than one FTM rollover, as you have to start keeping track of overflow interrupts and THOSE race conditions will give you some headaches...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2017 21:32:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/measure-time-using-FTM-input-capture/m-p/702858#M43180</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2017-09-13T21:32:20Z</dc:date>
    </item>
  </channel>
</rss>

