T
ThanksFor the digital one there is a series of different possibilities. One is use a CPLD and a crystal oscillator to drive the CPLD. Another one would be to use a micro-controller again with a crystal. The final one would be to use discrete digital logic chips to do it. In all three cases the output will be much more accurate. The question becomes what technology are you comfortable with?
In all three cases the basic idea is the same:
1. You have a 'gated' counter. It starts counting on the rising edge of the signal you want to measure the frequency of.
2. On the next rising edge, the counter value stops and is transferred to a comparison register.
3. The comparison register compares the counter value to an upper and lower limit (fixed) and if it is between those limits outputs a logic high, if not outputs a logic low.
The counter is basically calculating the period of the input wave form that is just the reciprocal of the frequency. And the logic is then determining if it is between the period necessary for a frequency of 47-51 Hz.
In this case the accuracy is based mostly on the number of bits in the counter. For better than say 1% you need a counter of at least 7 bits.
If you want a solution using a given technology, that is more details, that may take me a little while to get to you. But it is not difficult.