<?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: HCS08: Hot to set TPM in Input Capture on falling edge only in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165781#M10486</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;With your undefined macros or constants that you use, it is impossible to say whether the interrupt flag is being cleared or not.&amp;nbsp; The most direct method of clearing the flag is as follows -&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;TPM2C1SC_CH1F = 0;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This uses a standard bit definition, as defined within the HCS08 header files.&amp;nbsp; Note that because a specific&amp;nbsp;register bit is being addressed, this stipulates that it is a read-modify-write process,&amp;nbsp;which entirely meets the requirements of the flag clearing process, i.e. read the register and then&amp;nbsp;write a zero to&amp;nbsp;the flag bit.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Alternatively, the following should also work correctly -&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;TPM2C1SC &amp;amp;= 0x7F;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jun 2008 20:34:40 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2008-06-20T20:34:40Z</dc:date>
    <item>
      <title>HCS08: Hot to set TPM in Input Capture on falling edge only</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165773#M10478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm tryng to set channel 1 of TPM2 in input capture mode and to set the interrupt on falling edge only.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I set the control and status register in this way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;TPM2C1SC = 0x48;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My problem is that the interrupt flag is set on both edge and not only on falling edge...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Someone can help me???&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;filippo&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2008 15:34:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165773#M10478</guid>
      <dc:creator>Spell</dc:creator>
      <dc:date>2008-06-19T15:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08: Hot to set TPM in Input Capture on falling edge only</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165774#M10479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Setting looks correct.&amp;nbsp; Could it be a noise / bouncing switch problem?&amp;nbsp; (How are you testing?)&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2008 16:04:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165774#M10479</guid>
      <dc:creator>tonyp</dc:creator>
      <dc:date>2008-06-19T16:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08: Hot to set TPM in Input Capture on falling edge only</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165775#M10480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi tonyp,&lt;BR /&gt;I don't think is a noise problem because with an oscilloscope I can see clearly the interrupt is called on every edge and not only in the falling edge.&lt;BR /&gt;If I change the configuration of the edge in the TPM2C1SC register never change, the interupt flag is always set on both edge.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;filippo&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2008 16:10:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165775#M10480</guid>
      <dc:creator>Spell</dc:creator>
      <dc:date>2008-06-19T16:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08: Hot to set TPM in Input Capture on falling edge only</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165776#M10481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello filippo,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You have not clarified whether you are using any form of mechanical switch to provide the input signal.&amp;nbsp; All mechanical switches do bounce to varing degrees, and it is possible that both edges can spuriously occur at each transition.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For test purposes, you might set the channel to detect&amp;nbsp;both edges, and then see how many times the channel flag becomes set after a single switch transition.&amp;nbsp; This test&amp;nbsp;can be done outside of the channel ISR.&amp;nbsp; Simply provide a tight loop, while waiting for the the channel flag to become set.&amp;nbsp; Once it is set, clear the flag, read and store the capture value (perhaps within an array), and then wait&amp;nbsp;for the next capture event.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If there is more than a single reading for&amp;nbsp;each transition, you have bounce occurring.&amp;nbsp; The sequence of capture values will indicate the timing of&amp;nbsp;any bounce.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2008 17:53:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165776#M10481</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-06-19T17:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08: Hot to set TPM in Input Capture on falling edge only</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165777#M10482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;If you have set it for falling edges then it only triggers on falling edges!&lt;BR /&gt;It does work!&lt;BR /&gt;Turn that timebase down a little further.&lt;BR /&gt;I've got hundreds of GT16's doing it all day, everyday on positive edges ($44).&lt;BR /&gt;What device are you using and again where are the edges coming from?&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2008 18:08:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165777#M10482</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2008-06-19T18:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08: Hot to set TPM in Input Capture on falling edge only</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165778#M10483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;You have not clarified whether you are using any form of mechanical switch to provide the input signal.&amp;nbsp; All mechanical switches do bounce to varing degrees, and it is possible that both edges can spuriously occur at each transition.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;I don't use a mechanical switch for generate the edge, there is another MCU that generate the edge.&lt;BR /&gt;I use this edge to determine a start condition on a data line,that is a transition from low level to high and then from high to low.&lt;BR /&gt;I must have an interrupt on the second edge only (falling edge) but with all kind of input capture configuration the channel flag becomes set in both edges.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2008 19:32:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165778#M10483</guid>
      <dc:creator>Spell</dc:creator>
      <dc:date>2008-06-19T19:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08: Hot to set TPM in Input Capture on falling edge only</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165779#M10484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi Filippo,&lt;BR /&gt;&lt;BR /&gt;Are you properly clearing the flag in the ISR?&lt;BR /&gt;Which device are you using?&lt;BR /&gt;Show us your ISR code.&lt;BR /&gt;Exactly how are you determining that it is working wrongly?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 04:27:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165779#M10484</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2008-06-20T04:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08: Hot to set TPM in Input Capture on falling edge only</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165780#M10485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;INTERRUPT_KEYWORD void daliRx_InterruptHandler(void) {  __asm {                               /* The HCS08 does not save H on interrupt. */    PSHH  }  /* Clearing the flag requires reading it and then writing it. */  if ( gTPM2C1SC_c &amp;amp; gTPMxCnSC_F_c ) {    gTPM2C1SC_c &amp;amp;= ~gTPMxCnSC_F_c;a    daliStartRxCallBack();  }  __asm {    PULH  }}&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;This my interrupt service routine.&lt;BR /&gt;My device is a MC13213.&lt;BR /&gt;I can determine that the interrupt is working wrongly because I toggle a pin when the service interrupt is called and I can see clearly that this pis toggle in both edges which any kind of configuration of the timer channel.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;filippo&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:12:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165780#M10485</guid>
      <dc:creator>Spell</dc:creator>
      <dc:date>2020-10-29T09:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08: Hot to set TPM in Input Capture on falling edge only</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165781#M10486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;With your undefined macros or constants that you use, it is impossible to say whether the interrupt flag is being cleared or not.&amp;nbsp; The most direct method of clearing the flag is as follows -&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;TPM2C1SC_CH1F = 0;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This uses a standard bit definition, as defined within the HCS08 header files.&amp;nbsp; Note that because a specific&amp;nbsp;register bit is being addressed, this stipulates that it is a read-modify-write process,&amp;nbsp;which entirely meets the requirements of the flag clearing process, i.e. read the register and then&amp;nbsp;write a zero to&amp;nbsp;the flag bit.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Alternatively, the following should also work correctly -&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;TPM2C1SC &amp;amp;= 0x7F;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 20:34:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165781#M10486</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-06-20T20:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08: Hot to set TPM in Input Capture on falling edge only</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165782#M10487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I'm using code generated with Beekit so I don't have this standard bit defiition. But I don't think is this the problem because my macros are defined in this way:&lt;BR /&gt;&lt;BR /&gt;#define gTPM2C1SC_c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TPM2C1SC&lt;BR /&gt;#define gTPMxCnSC_F_c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x80&lt;BR /&gt;&lt;BR /&gt;So I think to clear in the right way the interrupt flag.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;filippo&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2008 19:23:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-Hot-to-set-TPM-in-Input-Capture-on-falling-edge-only/m-p/165782#M10487</guid>
      <dc:creator>Spell</dc:creator>
      <dc:date>2008-06-24T19:23:17Z</dc:date>
    </item>
  </channel>
</rss>

