The problem of identifying external square wave with 5 1 single chip microcomputer.
First of all, the square wave frequency generated by your circuit cannot exceed the highest frequency recognized by the single chip microcomputer, so try to choose the highest crystal oscillator supported by the single chip microcomputer (not absolute, such as measuring the high frequency of several gigahertz), and then the rest is the calculation problem in the program. You can set the rising edge or falling edge trigger, calculate the number of square waves in a certain period of time to find the period, then take the reciprocal and display the results. Pay attention to the ultra-low frequency test, you can test the ultra-low frequency alone like me.