Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

Frequency meter-generator-clock on MK AT89S8252. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Clocks, timers, relays, load switches

Comments on the article Comments on the article

The proposed device, in addition to measuring the frequency and period of signals, is able to count the number of input pulses, generate rectangular pulses, and also perform the functions of a clock with a calendar and a five-program alarm clock.

The device, the scheme of which is shown in Fig. 1, allows you to measure the frequency of periodic signals with TTL levels up to 110 MHz, count input pulses, measure the period of input signals, generate a square wave signal with a duty cycle of 2 and a frequency from 1 Hz to 3 MHz, display the current time, day of the week, date, month , year, and also work as an alarm clock. The current consumed by the device from a power supply with a voltage of 5 V ±10% does not exceed 30 mA (with the indicator backlight off).

Frequency meter-generator-clock on MK АТ89S8252

The basis of the device is an ATMEL AT89S8252 microcontroller (MC). It consists of an 8 KB ROM, a 2 KB EEPROM, a 256 byte RAM, four I/O ports, three timers/counters (T/CO-T/C2), a watchdog timer, a clock generator, and other components.

When using T/C as a counter of external pulses, the counting frequency cannot be more than 1/24 of the frequency of the clock generator. It is possible to increase the counting frequency, for example, by turning on a fast divider at the input, but this requires the introduction of switching nodes. In the described device, to increase the counting frequency at the input, high-speed counters of the KR1554 series are used, due to which the counting frequency increases by 256 times and theoretically can reach 128 MHz (with a quartz resonator at a frequency of 12 MHz). When using KR1554IE18 chips (DD2, DD3), the maximum frequency is 110 MHz.

After power is applied to input 9 of MK DD1, a reset signal is generated, the duration of which is determined by the parameters of the R1C3 circuit. Diode VD1 serves to quickly discharge the capacitor C3 after the power is turned off.

At the beginning of the program, the HG1 display is adjusted. In this case, its buffer is cleared, the display of the cursor and blinking are prohibited. To reduce the number of I/O lines required to write information to the display, the bus size is set to 4 bits.

Then the operating modes of the T / C are set, the necessary interruptions are resolved and the operating mode and frequency of the generator are restored, which were before the previous shutdown of the device. In all modes T/CO works as a timer. It is programmed in such a way that it overflows and breaks from it 50 times per second. During interrupt processing, the keyboard is polled, and exemplary signals are generated for the device to operate in the frequency counter mode.

Reset counters DD2, DD3 is carried out synchronously on the edge of the signal at the input C at the level of log. 0 at input R. This circumstance dictates conflicting requirements for the duration of the reset signal. On the one hand, to increase the count rate, it must be sufficiently small, on the other hand, with such a duration, reset may not occur at a low frequency of the input signal. To eliminate this contradiction in this device, it was decided to completely abandon the reset signal. After each measurement, the states of the counters are stored and are subtracted from the result obtained during the subsequent measurement.

T/C1 operation modes depend on the instrument operation mode and are described below.

The alarm clock is made on a DD4 chip. It contains all the nodes needed to count hours, minutes, seconds, days of the week, day, month, and year. It also has 56 bytes of RAM available for writing and reading. With a G1 element connected (for example, CR2032), the microcircuit can work up to 10 years, keeping all recorded data in memory. The required accuracy of the clock is set by a tuning capacitor C4, the contrast of the information displayed on the display is set by a tuning resistor R5. The SB 17 button is used to turn on the LED backlight of the display in the dark.

The device is switched to the frequency measurement mode by pressing the "F" button, period measurements - by the "P" button, generator - by the "G" button. With the same buttons, when the "S" button is pressed, they turn on the modes, respectively, of counting the input pulses, the clock and the alarm clock. An audible signal is emitted by the BQ1 emitter both when the button is pressed and when the alarm goes off. The signal generated when the button is pressed is turned off by disconnecting pin 4 of the DD1 chip, and the signal that sounds when the alarm goes off is pin 3.

Consider the operation of the device in various modes in more detail.

The device switches to the frequency measurement mode when the power is turned on, and also, as noted, after pressing the SB13 ("F") button. In this mode, the T/C1 is programmed to operate as an input pulse counter. After 1 s, the counting result is displayed on the top line of the display (Fig. 2a). At the same time, the signal period is calculated and the result is displayed on the bottom line.

Frequency meter-generator-clock on MK АТ89S8252

Sometimes, for example, when tuning a oscillator with smooth tuning to a certain frequency, it is convenient to measure more than once per second, but more often. This device has a mode where measurements are taken 10 times more often (every 0,1 s). The measurement result is displayed five times per second. The resolution in this case is reduced to 10 Hz. The transition to this mode is made by pressing the button SB12 ("R"). In this case, instead of the last digit of the measured frequency value, the sign "*" is displayed. To return to the normal frequency measurement mode, press the SB8 ("B") button.

The response time to an interrupt depends on the command being executed and can reach several microseconds. To eliminate the error arising for this reason, the MC, after performing the current actions, is transferred to a mode with reduced power consumption. In this mode, the processor stops, but all peripherals continue to function. When an interrupt occurs, all necessary actions are performed and the MK is again put into low power mode. The interrupt response time in this case is always the same and is easily taken into account when forming time intervals.

In the period measurement mode, the timer / counter T / C1 is programmed to count the pulses coming from the internal divider. Their repetition rate is equal to V12 of the generator frequency, i.e. 1 MHz. The resolution of the account is carried out from the input INT1 (vyv. 13) DD1: with a log. 1 at this input, pulse counting is enabled, with a log. 0 - disabled. At the moment of level difference from 1 to 0, an interrupt is generated, during the processing of which the counting result is displayed on the bottom line of the display (Fig. 2, b). At the same time, the frequency of the signal is calculated (with an accuracy of thousandths) and the result is displayed on the top line of the display. It is not recommended to apply a signal with a frequency of more than 10 kHz to the instrument input, since interrupt processing from the INT1 input will take almost all the time and there will be no time left to process the result and poll the keyboard.

In input pulse counting mode, the T/C1 is also programmed to operate as an external pulse counter. The counting result (Fig. 2c) is displayed on the display screen 50 times per second. By pressing the button SB8 ("B"), if necessary, stop the counting of pulses (in this case, the ">" sign goes out). By pressing the SB8 button again, the account is resumed. To reset the counter, use the SB12 ("R") button. It must be taken into account that the reaction to pressing any button occurs after 100 ms (the time required to suppress contact bounce).

The value of the frequency of the generated pulses is entered using the digital buttons "0" - "9". Pressing the SB8 ("B") button removes the rightmost digit. The top line of the indicator (Fig. 2d) displays the dialed frequency, the bottom line shows the real frequency of the generator, which is determined by the formula 3000000/T (T varies from 1 to 65535). Thus, by typing, for example, the number 55000, we actually get 55555.555 (3000000/54). When you press the SB12 ("R") button, the generator frequency changes.

At a frequency of 46 Hz to 3 MHz, T / C2 operates in generator mode. Its output is connected to pin 1 DD1. T/C2 overflow interrupts are disabled. At lower frequencies (1 to 45 Hz) T/C2 is used as a timer with interrupts enabled. Their frequency depends on the set frequency of the generator and lies within 16...90 Hz. In the range of 8 ... 45 Hz, the signal at pin P1.0 is inverted every time T / C2 overflows (the output signal frequency is two times lower than the interruption frequency). At frequencies of 1 ... 7 Hz, the signal is inverted 2, 3, 5 or 8 times, depending on the frequency. The interrupt from T/C2 is a low priority one, as otherwise the error will increase when the device is operating in the frequency counter mode. In this regard, the period of the output signal may differ slightly (by a few microseconds) from the calculated value.

The signal at the output of the generator is present regardless of the operating mode of the device. When the frequency is set to 0 Hz, the generator is turned off.

The current time is set with the buttons "1" (hours), "2" (minutes), "3" (zero seconds), "4" (day of the week), "5" (day), "6" (month) and "7" " (year) while pressing the button "B" (if the readings need to be increased) or "R" (if they need to be reduced). The display in clock mode is shown in fig. 2, d.

There are five alarm clocks in the described device. For each of them, you can set the hour, minute and day of the week. Switch alarms by pressing the "0" button. The operating time is entered in the same way as described above for setting the clock. The day of the week is set with the buttons "3" - "9" ("3" - Monday, "4" - Tuesday, ... "9" - Sunday). When the button is pressed again, the symbol of the corresponding day disappears from the display. Examples of setting alarms are shown in fig. 2, f-h. In the first case, alarm 1 will sound on weekdays at 6:30, in the second (alarm 2) - on weekends at 8:00, in the third (alarm 3) - daily at 18:42. Please note that alarms will only work if the device is in clock mode. You can turn off the sound signal by pressing any button (except, of course, SB17).

Table with codes "firmware" ROM MK in hex-format

A few words about the details. Microcircuits KR1554IE18 are replaceable by their counterparts from the K555, KR1533 series, and with a corresponding change in the circuit, and other counters of the K555, KR1533, K531, KR1554 series. Depending on the counters used, the maximum counting frequency will be in the range of 20 ... 128 MHz. Instead of that indicated on the diagram, it is permissible to use the DV16252 indicator. The purpose of its pins is the same as that of the DV16230S1FBLY/R, you only need to swap the power pins 1 and 2.

There are several ways to calibrate the instrument.

1. Having switched the device to the frequency measurement mode, apply a known frequency signal to the input and set this value on the indicator with a tuning capacitor C1. The higher the frequency of the input signal, the more precisely the device will be tuned.

2. Having connected an exemplary frequency meter in parallel with the input of the device and switching to the frequency measurement mode, apply a signal to the input. By changing the capacitance of the capacitor C1, ensure that the readings of the devices coincide. As in the first case, the higher the frequency of the input signal, the more accurately you can tune the device.

3. Switching the device to the period measurement mode, apply a known frequency signal to the input and set the required value with the capacitor C1. The longer the period of the input signal, the more accurate the instrument setting. When calibrating in this way, it is convenient to use a 1 Hz signal from an electronic clock.

4. Having set the frequency of 3 MHz at the output of the generator, apply a signal to the input of the exemplary frequency meter. By changing the capacitance of the capacitor C1, set the frequency to 3 MHz.

Author: A. Piskaev, Orel

See other articles Section Clocks, timers, relays, load switches.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

Artificial leather for touch emulation 15.04.2024

In a modern technology world where distance is becoming increasingly commonplace, maintaining connection and a sense of closeness is important. Recent developments in artificial skin by German scientists from Saarland University represent a new era in virtual interactions. German researchers from Saarland University have developed ultra-thin films that can transmit the sensation of touch over a distance. This cutting-edge technology provides new opportunities for virtual communication, especially for those who find themselves far from their loved ones. The ultra-thin films developed by the researchers, just 50 micrometers thick, can be integrated into textiles and worn like a second skin. These films act as sensors that recognize tactile signals from mom or dad, and as actuators that transmit these movements to the baby. Parents' touch to the fabric activates sensors that react to pressure and deform the ultra-thin film. This ... >>

Petgugu Global cat litter 15.04.2024

Taking care of pets can often be a challenge, especially when it comes to keeping your home clean. A new interesting solution from the Petgugu Global startup has been presented, which will make life easier for cat owners and help them keep their home perfectly clean and tidy. Startup Petgugu Global has unveiled a unique cat toilet that can automatically flush feces, keeping your home clean and fresh. This innovative device is equipped with various smart sensors that monitor your pet's toilet activity and activate to automatically clean after use. The device connects to the sewer system and ensures efficient waste removal without the need for intervention from the owner. Additionally, the toilet has a large flushable storage capacity, making it ideal for multi-cat households. The Petgugu cat litter bowl is designed for use with water-soluble litters and offers a range of additional ... >>

The attractiveness of caring men 14.04.2024

The stereotype that women prefer "bad boys" has long been widespread. However, recent research conducted by British scientists from Monash University offers a new perspective on this issue. They looked at how women responded to men's emotional responsibility and willingness to help others. The study's findings could change our understanding of what makes men attractive to women. A study conducted by scientists from Monash University leads to new findings about men's attractiveness to women. In the experiment, women were shown photographs of men with brief stories about their behavior in various situations, including their reaction to an encounter with a homeless person. Some of the men ignored the homeless man, while others helped him, such as buying him food. A study found that men who showed empathy and kindness were more attractive to women compared to men who showed empathy and kindness. ... >>

Random news from the Archive

Smart parking based on LTE networks 09.12.2015

LG Uplus, the third largest South Korean mobile operator, announced the creation of a parking zone monitoring system based on LTE technology.

The service developed by LG Uplus involves the use of special sensors installed in parking lots and connected to an isolated narrow-band LTE network, which in turn connects to public mobile networks. The data recorded by these sensors helps car owners to remotely find a free space or their car in a parking lot using smartphones or other devices that support cellular communication.

LG Uplus says narrow-band LTE networks have low latency and support the connection of a large number of low-cost industrial IoT devices. First, developers are going to test this technology on a smart parking system, which will soon be deployed in the Seoul laboratory of LG Uplus, which is developing fifth generation networks (5G). Then the novelty is planned to be introduced into electricity consumption metering units, various security systems, etc.

According to analysts, the size of the paid parking market in Seoul is 1,5 trillion won ($1,3 billion), and across South Korea - 3-4 trillion. won ($2,6-3,5 billion).

Other interesting news:

▪ Aliens pollute the universe

▪ Conductive protein for 3D microarray assembly

▪ Self-healing chips

▪ Plastic skin feels the force of touch

▪ Ancient fresco

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ section of the site Winged words, phraseological units. Selection of articles

▪ article O tiger! Rejoice that you are not a man! Popular expression

▪ article What heights did the blind climber Erik Weienmeier achieve? Detailed answer

▪ article Storekeeper of a warehouse of a repair shop. Standard instruction on labor protection

▪ article Mordant to imitate mahogany. Simple recipes and tips

▪ article Unusual knot. Focus secret

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024