News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Counter command mystery

Started by Wimax, Dec 26, 2022, 09:16 AM

Previous topic - Next topic

Wimax

Hello Everybody !  ;D

I'm experiencing something new in these days with the Counter command. The MCU I'm using is a 24FJ64GA002 @ 32 MHz, after trying the command on several boards with which the reading was always quite accurate, I now have two boards in which there is a non-constant error (same quartz).
Making tests with a signal from 30 KHz to 100 KHz, counting the number of pulses per 1 ms, I get an overestimation that from about 12% tends to cancel out.
I am quite confident of the frequency accuracy of the source, which has been used often before. If it were a processor clock problem (in this case slower than the program claims) and if the Counter command counts the pulses in the time window (actually longer than 1 ms) the error should not go down as the frequency of the input signal increases...

-- SOLVED --

In addition to the test with the Counter command, I checked the acquired signal via FFT and the line was shifted by about -8%. From there everything seemed terribly clear...checking the PCB and the BOM again I realised that I had in fact changed from an 8 MHz to a 7.37 MHz I was convinced I had the same quartz model as the other boards, the package is identical.  Never be too sure !