3 Replies Latest reply on Aug 9, 2016 2:58 AM by william.stanley

    PSoc 4 BLe Timer problem

    william.stanley

      Hi, I'm using a '042-BLE' kit here and it's working fine. But I can't get a timer interrupt to work. Here is the main code:

         

       * ========================================
      */
      #include <project.h>

         

       
      uint16 ms_count = 0;
       
      CY_ISR(MY_ISR)
          {
          ms_count++;
           
          if(ms_count == 1000)
              {               // 1 second
              LED_2_Write(!LED_2_Read()); // Toggle LED
              ms_count = 0; // reset ms counter
              }
          }
       
      int main()
      {
          Timer_Start(); // Configure and enable timer
          Timer_ISR_StartEx(MY_ISR); // Point to MY_ISR to carry out the interrupt sub-routine
          CyGlobalIntEnable; // Enable global interrupts
           
          for(;;)
          {
              // Infinite loop for timer/interrupt to keep executing
          }
      }

         


      The pin output is square running at 900us, not 1 second I had hoped for. Changing the clock frequency makes no difference.

         

      This is going to be such a silly problem, I'm already embarrassed, but I've at this for some time and I can't see what is wrong.

         

      Project is  attached.