4 Replies Latest reply on Dec 26, 2010 9:04 AM by gautam.das.g

    Simple 100 ms Interrupt

    terry.hansen

      I would like to generate an interrupt every 100 ms in a CY8C3866.  When I do this with a timer using the tc output pin, the ISR keeps firing about every 15 us or so for about 1 ms.  It looks like the cause is that the tc pin stays high for about 1 ms after the unit reaches terminal count.  How do I reset the count so the interrupt stops firing?  Simple question I know.  I'm new to PSoC.  In a Microchip processor, I would just clear the interrupt and write a new value in the counter.  But that does not work with this timer.  Not sure what I'm doing wrong.  I've read the datasheet for the timer several times and tried 3 or 4 ways of configuring and wiring the timer.  Here's my current version of the ISR code:

         

       

         

       

         

       

         

      /* `#START ISR_100ms_Interrupt` */

         

      ++isrCount;

         

      Timer_1_WriteCounter(Timer_1_INIT_PERIOD);

      Timer_1_WritePeriod(Timer_1_INIT_PERIOD);

      Timer_1_GetInterruptSource();

       

       

      Thanks in advance!

          /* `#END` */ An axample project with a simple 100 ms timer ISR would be great.  If anyone knows where to find that on the Cypress website, please let me know.  Otherwise, can someone point out what I'm doing wrong?   
        • 1. Re: Simple 100 ms Interrupt
          kenny.millar.2

           Instead of enabling the TC interrupt in the timer object, leave the interrupts disabled, and connect an 'Interrupt' component to the TC pin. Set the Interrupt to 'rising edge' triggered and that should resolve the issue.

          • 2. Re: Simple 100 ms Interrupt
            udayan.umapathi

             Hi,

               

            You can do the following to achieve 100mS interrupt. Connect the TC terminal of Timer to an ISR as shown in figure, TimerWith-ISR. And set the Timer configuration as shown in 

            • 3. Re: Simple 100 ms Interrupt
              udayan.umapathi

               Hi,

                 

              You can do the following to achieve 100mS interrupt. Connect the TC terminal of Timer to an ISR as shown in figure, TimerWith-ISR. And set the Timer configuration as shown in Configure Timer. Zip file attached has the pics.

                 

               

                 

              Regards,

                 

              Udayan

                 
                      
              • 4. Re: Simple 100 ms Interrupt
                gautam.das.g

                Hi THansen,

                   

                 

                   

                The High pulse on TC will last for 1 clock cycle period of the input clock to the Timer Component.

                   

                If you are using 1KHz clock, then you will see a 1ms pulse on TC.

                   

                In the 'Configure' tab of the Timer Component, set the 'Run Mode' to 'Continuous'.

                   

                You can connect an Interrupt component to the TC terminal. Or connect it to the 'interrupt'  terminal after checking Interrupts 'On TC' in the Configuration Box.

                   

                 

                   

                Let us know if this works.

                   

                 

                   

                Cheers,

                   

                dasg