5 Replies Latest reply on Jan 19, 2019 11:44 PM by BoTa_264741

    Need help with counter

    DaHu_285096

      I am having trouble understanding how to use the counter component to measure frequency. I did google and find the example for frequency counter and thought I could use software to enable the timer instead of the PWM. But the document does not give any example code for reading the counter - so I assume you simply Counter_ReadCounter().

       

      Attached is the code snippet I am trying and the settings I used for the counter.

       

      The input signal is 125.05 kHz and the sample window is 10ms

       

      The input signal is correct (I am viewing on a scope and have frequency counter attached).

       

      The count should be 1250 but I am getting wild values from 1100 to 2000

       

      From what I read, the counter is enabled and reset when the component is Started, it then starts counting up and when stopped, the count register holds the number of transitions over the period.

       

      Thanks in advance