Description: This is a design for a frequency meter based on AVR microcontrollers. Maximum input frequency is specified to be 30 MHz in the multi-chip configuration, and in single-chip configuration, there are both 5 MHz and 10 MHz versions operating with 10 and 20 MHz crystals, respectively. All versions have 9 1/2 digit resolution. I have used the multi-chip version at 40 MHz, and depending upon the actual chips you use and your layout, it can work at much higher input frequencies. The 10 MHz single-chip version using the ATtiny2313 is ideal for use with a X10 or X100 prescaler. As for microcontroller choice, the requirements for this firmware are that the controller be an AVR with a 16-bit counter, has a RAM stack and UART or USART, and the ability to operate at 10 MHz. Some modification may be required to the code to accommodate a USART instead of a UART, a 16-bit stack pointer instead of the 8-bit pointer on the AT90S2313, and the specific controls of the 16-bit counter registers. I used an AT90S2313 because they are available to me and suitably small. For the 10 MHz input single-chip configuration, you need to use an AVR that can clock at 20 MHz. I used an ATtiny2313-20. When programming the ATtiny2313, remember to select a fuse setting for the internal clock oscillator. The AT90S2313 does not have clock fuse settings.
The first phase was to make a high-resolution frequency meter/counter just using the AT90S2313 or ATtiny2313, then to add the external prescaler. Without the prescaler, the maximum input frequency for the frequency meter is 5 MHz or 10 MHz, depending upon the chip you use and the firmware version you choose. With the multi-chip version that includes a prescaler, the maximum input frequency, according to the component specifications, is about 30 MHz - this will vary with individual external prescaler chips and your circuit layout. To summarize, there are three versions of the code available at the top of this page: The 5 MHz single-chip version, which is basically an AT90S2313-10 clocked at 10 MHz and a serial interface, the 10 MHz single-chip version which is basically an ATtiny2313-20 clocked at 20 MHz with a serial interface, and the 30 MHz multi-chip version, which is the same circuit as the 5 and 10 MHz versions, but with the prescaler and quad NOR gate added. In the 30 MHz version, the maximum input frequency for the counter mode (counts until reset via ASCII command) is 5 MHz. The timebase selections between the two versions differ as well. The 30 MHz version has timebases of 0.1, 1, 10, and 100 seconds. Frequency measurement is performed by clocking the 74HC4060, which is capable of being clocked at over 30 MHz, and then counting the overflow pulses from the 8th flip-flop in the 74HC4060's signal path using the AT90S2313-10's on-chip 16-bit counter, which is limited to a maximum input clock rate of 5 MHz (30 MHz/256= 117 kHz). At the end of a frequency measurement period, the input to the 74HC4060 is gated off by turning the bi-directional I/O port, D3, on the AT90S2313-10 from a high impedance input to an output set high. This results in the input signal being dropped across the 2.2k resistor between pin 13 of the 74HC02 and the clock input of the 74HC4060. This technique is borrowed from Chris Krah's LC frequency meter design, where he used this method to gate the input to a counter using an AT90S1200's I/O pin. After moving the contents of the AT90S2313-10's on-chip 16-bit counter to working registers, the AT90S2313-10 toggles the clock pin on the 74HC4060 while decrementing an internal register from $FF until the 74HC4060 toggles again. This way, the contents of the prescaler are transferred to an internal register within the AT90S2313-10.
So far, this accounts for three bytes: the 8 bits of the 74HC4060 and the 16-bit on-chip counter. Overflow from the 16-bit on-chip counter causes an interrupt, during which a fourth byte is incremented. If incrementing this fourth byte results in the byte becoming equal to zero, an internal overflow flag bit is set so that overflows will be denoted in the display. The resulting 32 bits are converted to 9 1/2 decimal digits and sent via the UART to a terminal or display.
In the counting mode, the instrument needs to be able to display the current total count several times per second, so the display appears to be a continuous display of the running total. While displaying the total count, it cannot miss an incoming pulse, and since the prescaler would have to be emptied for each measurement to read out its contents, and while reading out its contents, some pulses could be missed, it is necessary to bypass the prescaler and count directly using the AT90S2313-10's on-chip 16-bit counter. Overflows from the counter cause interrupts which then cause a virtual 16-bit internal register (ZH, ZL) to be incremented, checking for overflow of the Z register, thus providing a 32-bit count. The maximum clock rate for the on-chip 16-bit counter is 5 MHz.
The version of the code that does not use a prescaler (nfmtr040916A.asm) uses the same set of registers as the counting mode for the prescaler version of the code; it just uses the 16-bit on-chip counter and overflows to the Z register.
The first gate that the input signal encounters is a 74HC02, which acts as an inverting buffer. It drives both the 74HC4060, which serves as the 30 MHz prescaler, and the other sections of the 74HC02 that act as a multiplexer to drive the AT90S2313-10's on-chip 16-bit counter with either the output of the prescaler in frequency measurement modes or directly from the output of the buffer in counting mode. Without the buffer, pulses from the gating of the input of the 74HC4060 would appear on the input. The version of the code that does not use a prescaler does not require the buffer or multiplexer; the input signal drives D5 (pin 9) of the AT90S2313-10 directly.
The frequency meter design incorporates multiple configurations to accommodate various input frequencies and enhance measurement accuracy. The integration of the 74HC4060 prescaler allows for high-frequency measurements, while the microcontroller's architecture ensures efficient processing of frequency data. The system's design emphasizes flexibility, enabling the selection of different time bases and accommodating various microcontroller configurations, thus providing a robust solution for frequency measurement applications.This is design for a frequency meter based on AVR microcontrollers. Maximum input frequency is specified to be 30 MHz in the multi-chip configuration, and in single-chip configuration, there are both 5 MHz and 10 Mhz versions operating with 10 and 20 MHz crystals, respectively. All versions have 9 1/2 digit resolution. I have used multi-chip version at 40 Mhz, and depending upon the actual chips you use and your layout, it can work at much higher input frequencies.
The 10 MHz single-chip version using the ATtiny2313 is ideal for use with a X10 or X 100 prescaler. As for microcontroller choice, the requirements for this firmware are that the controller be an AVR with a 16 bit counter, has a ram stack and UART or USART, and the ability to operate at 10 MHz. Some modification may be required to the code to accommodate a USART instead of a UART, a 16 bit stack pointer instead of the 8 bit pointer on the AT90S2313, and the specific controls of the 16 bit counter registers.
I used an AT90S2313 because they are available to me and suitably small. For the 10 MHz input single-chip configuration, you need to use an AVR that can clock at 20 MHz. I used an ATtiny2313-20. When programming the ATtiny2313, remember to select a fuse setting for the internal clock oscillator. The AT90S2313 does not have clock fuse settings. The first phase was to make a high resolution frequency meter/counter just using the AT90S2313 ot ATtiny2313, then to add the external prescaler.
Without the prescaler, the maximum input frequency for the frequency meter is 5 MHz or 10 MHz, depending upon the chip you use and the firmware version you choose. With the multi-chip version that includes a prescaler, the maximum input frequency, according the the component specifications, is about 30 Mhz - this will vary with individual external prescaler chips and your circuit layout.
To summarize, there are three versions of the code available at the top of this page: The 5 MHz single-chip version, which is basically an AT90S2313-10 clocked at 10 MHz and a serial interface, the 10 MHz single-chip versoin with is basically an ATtiny2313-20 clocked at 20 MHz with a serial interface, and the 30 MHz multi-chip version, which is the same circuit as the 5 and 10 MHz versions, but with the prescaler and quad NOR gate added. In the 30 MHz version, the maximum input frequency for the counter mode (counts until reset via ASCII command) is 5 MHz.
The timebase selections between the two version differ as well. The 30 MHz version has timebases of 0.1, 1, 10,and 100 seconds. Frequency measurement is performed by clocking the 74HC4060, which is capable of being clocked at over 30 MHz, and then counting the overflow pulses from the 8th flip-flop in the 74HC4060's signal path using the AT90S2313-10's on-chip 16 bit counter, which is limited to a maximum input clock rate of 5 MHz 30 MHz/256= 117 kHz). At the end of a frequency measurement period, the input to the 74HC4060 is gated off by turning the bi-directional I/O port, D3, on the AT90S2313-10 from a high impedance input to an output set high.
This results in the input signal is then dropped across the 2.2k resistor between pin 13 of the 74HC02 and the clock input of the 74HC4060. I borrowed this technique from Chris Krah's LC frequency meter design in which he used this method to gate the input to a counter using an AT90S1200's I/O pin.
After moving the contents of the AT90S2313-10's on-chip 16 bit counter to working registers, the AT90S2313-10 toggles the clock pin on the 74HC4060 while decrementing an internal register from $FF until the of the 74HC4060 toggles again. That way, the contents of the prescaler is transferred to an register internal to the AT90S2313-10. So far, that accounts for three bytes: The 8 bits of the 74HC4060 and the 16 bit on-chip counter. Overflow from the 16 bit on-chip counter causes an interrupt, during which a fourth byte is incremented.
If incrementing this fourth byte results in the byte becoming equal to zero, an internal overflow flag bit is set so that overflows will be denoted in the display. The resulting 32 bits are converted to 9 1/2 decimal digits and sent via the UART to a terminal or display.
In the counting mode, the instrument needs to be able to display the current total count several times per second, so the display appears to be a continuous display or the running total. While displaying the total count, it cannot miss an incoming pulse, and since the prescaler would have to be emptied for each measurement to read out its contents, and while reading out its contents, some pulses could be missed, it is necessary to bypass the prescaler and count directly using the AT90S2313-10's on-chip 16 bit counter.
Overflows from the counter cause interrupts which then causes a virtual 16 bit internal register (ZH,ZL) to be incremented, checking for overflow of the Z register, thus giving a 32 bit count. The maximum clock rate for the on-chip 16 bit counter is 5 MHz
The version of the code that does not use a prescaler (nfmtr040916A.asm) and uses the same set of registers as the counting mode for the prescaler version of the code - it just uses the 16 bit on-chip counter and overflows to the Z register.
The fist gate that the input signal sees, a 74HC02, is an inverting buffer. It drives both the 74HC4060, which is the 30 MHz prescaler, and the other sections of the 74HC02, which act as a multiplexer to drive the AT90S2313-10's on-chip 16 bit counter with either the output of the prescaler in frequency measurement modes or directly from the output of the buffer in the counting mode. Without the buffer, pulses from the gating of the input of the 74HC4060 would appear on the input. The version of the code that does not use a prescaler does not require the buffer or multiplexer - the input signal drives D5 (pin 9) of the AT90S2313-10 directly.
The circuit interfaces an LED with an AVR microcontroller (ATMega16). The components used include one ATMega16 microcontroller, a 10K resistor, a 16uF/25V capacitor, a push button switch, and a green LED bar instead of eight individual LEDs. The power supply...
The ProfiLab-Expert software allows you to develop your own digital or analogue measuring technology projects. It doesn't matter if you want to create analogue measurements or digital controls - you can realize it all. And for all this you don't...
The TRW-24G connector pins are quite small, approximately 1mm apart. To address this issue, an adaptor PCB has been ordered to convert the small connector of the RF module to a standard pin connector. The pin arrangement of the RF...
AVR has two different programming modes called Parallel Programming Mode (Parallel Mode) and Serial Downloading Mode (ISP mode). In Parallel Mode, the programming is done using multiple data lines simultaneously, allowing for faster programming speeds. This mode is typically used...
AVRtools features an intuitive graphical user interface and utilizes predefined function blocks. It provides a wide array of basic functions, including timers, counters, logic operations, and analog signal processing. Additionally, it includes function blocks for sending SMS messages over the...
CodeLock AVR electronic combination lock is realised with Atmel AVR microcontroller AT90S2313 or ATtiny2313. Program in hex code is 2 kB long. User code is consisted of 1 to 4 digits. If you buy the chip than user code is...
The widespread application of Flash technology in microprocessors has led to significant advancements in the development and utilization of one-chip computers. Designers have transitioned from traditional in-circuit emulators (ICE) and JTAG interfaces to more cost-effective and user-friendly development methods. While...
The design generates varying sampling clock write strobe pulses using an ATtiny2313 microcontroller from Atmel. For a 10MHz sampling clock, a 20MHz clock is required for the ATtiny2313, necessitating a power supply of 5V instead of 3.3V, which is typical...
This is a straightforward X-Y oscilloscope design utilizing an ATmega324P microcontroller and two KAD0820 analog-to-digital converters (similar to National Semiconductor's ADC0820). The initial version of this oscilloscope was based on an AT90S4414, necessitating the use of external ADCs. Various rose...
We use cookies to enhance your experience, analyze traffic, and (if you allow) serve personalized ads.
By clicking Accept All, you agree to our use of cookies.
Learn more