4 Replies Latest reply on Jun 11, 2018 11:51 AM by e.pratt_1639216

    PSoC4100s use WCO as timer's clock source

    qipanli_3374261

      we are using PSoC4100s, setup WCO as timer0's clock source, measure the frequency of timer0 and found it not in WCO's 32768 frequency.

      our configuration as the follows.

      codes like the follows:

      void timer0_isr(void)

      {

          set_a_Write(1);

          set_a_Write(0);

          CySysTimerClearInterrupt(0);

          CySysTimerSetMatch(0, CySysTimerGetCount(0) + 100);

      }

      void timer0_init(void)

      {

          CySysClkSetTimerSource(CY_SYS_CLK_TIMER_SRC_WCO);

          CySysTimerDisable(CY_SYS_TIMER0_MASK);

          CySysTimerResetCounters(CY_SYS_TIMER0_RESET);

          CySysTimerSetInterruptCallback(0, timer0_isr);

          CySysTimerSetMode(0, CY_SYS_TIMER_MODE_INT);

          CySysTimerSetClearOnMatch(0, 1);

          CySysTimerSetMatch(0, CySysTimerGetCount(0) + 100);//100 ticks

          CySysTimerEnableIsr(0);

          CySysTimerEnable(CY_SYS_TIMER0_MASK);

          set_a_SetDriveMode(set_a_DM_STRONG);

          set_a_Write(0);

      }

      we want pull up set_a pin in every 100 ticks, but the frequency is not from WCO's 32768 but seems from the ILO.