using stm8s003f3p6 for frequency counter
Since your result (f) is a 32-bit number, your resolution could theoretically be one part in 4,294,967,296.  Your present design counts for only one millisecond, so your answer will be in kilohertz with a resolution of one kHz.  TIM1_CNTRL is only the low byte of your answer; the result is the variable &quot;f&quot;.  You can get more resolution by increasing the value of delayms().  I don't see in your code where you output the answer.  If you increased to delayms(1000), and inserted a printf command to report the value of f after &quot;f=fr*65536+f;&quot; you would get an answer in Hz once per second.
The timer can probably handle 10 MHz if it's a clean digital signal, but not much higher.
Also the accuracy will be determined by the accuracy of your delayms() function.
Good luck!