Hi Guys,
I use the teensy 3.6 together with the library freqcounter library ( https://github.com/PaulStoffregen/FreqCount ) in order to measure frequency up to 65 MHz.
The gate length is set to the minimum value of 1 (milli sec).
In general it works quite fine.
However every now and then it happens that the frequency count value reaches very high values.
I've tried to understand the code in the FreqCount-Lib. Maybe it happens in the ISR-function from the FreqCount-Lib:
(line 99-101 in FreqCount.cpp)
count = ((uint32_t)count_msw << 16) + count_lsw;
count_output = count - count_prev;
count_prev = count;
if count is less than count_prev the substraction might result in a huge number. Am I correct?
Any Ideas?
Here is an example:
Input-Frequency: 40 MHz
count_output (most of the time) = 40000
count_output (occasionally) = 4294941760
Interestlingly this number obeys the following equation:
4294941760 = 2^32 - (2^16-40000)
I use the teensy 3.6 together with the library freqcounter library ( https://github.com/PaulStoffregen/FreqCount ) in order to measure frequency up to 65 MHz.
The gate length is set to the minimum value of 1 (milli sec).
In general it works quite fine.
However every now and then it happens that the frequency count value reaches very high values.
I've tried to understand the code in the FreqCount-Lib. Maybe it happens in the ISR-function from the FreqCount-Lib:
(line 99-101 in FreqCount.cpp)
count = ((uint32_t)count_msw << 16) + count_lsw;
count_output = count - count_prev;
count_prev = count;
if count is less than count_prev the substraction might result in a huge number. Am I correct?
Any Ideas?
Here is an example:
Input-Frequency: 40 MHz
count_output (most of the time) = 40000
count_output (occasionally) = 4294941760
Interestlingly this number obeys the following equation:
4294941760 = 2^32 - (2^16-40000)
Last edited: