4 Replies Latest reply on Jun 7, 2019 10:58 AM by ScCl_3419596

    How to clear Timer using a TCPWM Component

    ScCl_3419596

      I am having a heck of a time trying to clear an interrupt using the timer function on a TCPPWM component.  The API states to use void ISR_ClearPending(void) but this does not appear in the API when i try to use it.  The data sheet also talks about block/status register needing to be read/cleared, but doe snot tell how this is done.  Could i get some help on how to do this properly. I will also attach my project for reference.

      CLR_INT_API.png

        • 1. Re: How to clear Timer using a TCPWM Component
          JoMe_264151

          The interrupt has to be cleared at the TCPWM.

          Use Timername_ClearInterrupt(Timername_GetInterruptSource()) to remove all interrupts.

          Clearing the interrupt in the isr component is not required.

           

          Bob

          • 2. Re: How to clear Timer using a TCPWM Component
            MoTa_728816

            Hi,

             

            May be this is supererogatory,

            I always felt bewildered when I had to use <Module>_ClearInterrupt(interruptMask),

            to find what is the "interruptMask".

             

            Recently I found a way to find it, may be there is/are better ways, though.

             

            (1) When I enter xxx_ClearInterrupt(),

                 I notice that I must provide "interruptMask",

                 but I have no idea what is the name/value of the interruptMask.

            000-Timer_interrupt_mask.JPG

            (2) So, to avoid "error" I fill "0' for the time being.

            001-Clear_interrupt_0.JPG

            (3)  Now as the line is grammatically correct, we can use the pull-down menu -> Go To Definition

            002-goto_definition.JPG

            (4) Then in the definition of ClearInterrupt() function, the comment shows the usable parameters.

                There I cheat to copy the "correct" defined value, this time "Tmer_INTR_MASK_TC".

            002-definition.JPG

            (5) Paste the correct mask value into my (or your) program

            003-Flag_entered.JPG

             

            moto

            P.S.

            Well, Today I learned "Timername_ClearInterrupt(Timername_GetInterruptSource())".

            This will be better if possible interrupt source is only 1 or you have already taken care of each cases before clearing the flag.

            • 3. Re: How to clear Timer using a TCPWM Component
              JoMe_264151

              Well, Mr. Motoo

              It is nice to see that even me could teach you new tricks by using _GetInterruptSource()

               

              Happy coding

              Bob

              • 4. Re: How to clear Timer using a TCPWM Component
                ScCl_3419596

                thank you so much for the help ... i actually was able to do it reading AN90799 on page 10 in regards to the interruptMask.

                Interrupt Solution.png

                and looking  at the XXX.h file i found the mask.

                 

                After reading your post your way sure seems easier!

                 

                thanks again

                 

                Scott