下面一段話是在網(wǎng)上摘錄下來(lái)的,開(kāi)了之后終于解開(kāi)了我的頻率計(jì)為何不能準(zhǔn)確的測(cè)480KHz以上的信號(hào)了。
The 8052 microcontroller has internal timers (T0, T1, and T2 if you are using an 8052), but they are limited to the speed of your microcontroller, which is in turn limited to the speed of your crystal. If you have a standard Intel 8052 running with a 12MHZ crystal, your timers will be incremented 1,000,000 times per second (1MHZ). Since you are counting high/low transitions and the source must remain high or low for at least one cycle, the theoretical maximum resolution for such a configuration would be 500,000 (500Khz). Tricks and external components may be used to measure higher frequency events.
如果8052單片機(jī)的晶振頻率為12MHz的話,那么計(jì)數(shù)器最大計(jì)數(shù)為1MHz,但是由于8052單片機(jī)在測(cè)頻率的時(shí)候,至少需要兩個(gè)時(shí)鐘周期,理論上所能測(cè)得頻率的最高至為500Khz.
難怪我改了定時(shí)器的定時(shí)時(shí)間為10ms,都不濟(jì)于事,本以為是計(jì)數(shù)器變量溢出了,那就把1s改為10ms,那不就不會(huì)溢出了,結(jié)果還是不行,看了看網(wǎng)上的資料,終于明白了,若真要測(cè)480KHz的信號(hào),那就只能拿個(gè)頻率更高的晶振了。。
不知這樣的理解是否合理,還望各位多多指點(diǎn)。