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

New modes in the combined measuring instrument. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Measuring technology

Comments on the article Comments on the article

During the operation of the combined instrument [1], the program of its microcontroller was significantly improved. The new version 2.03 of this program provides the user, in addition to the already available modes for measuring the frequency of the input signal and single sweep in the logic analyzer. New functions are implemented in a purely software way, no changes had to be made to the hardware of the device.

The single sweep mode was provided from the very beginning in the instrument's oscilloscope, but the author did not implement it in the logic analyzer, although it is no less useful in it. In the new version of the microcontroller program, this omission is corrected.

Now we can say that the logic analyzer, like the instrument's oscilloscope, has two sweep modes: regular and single. They are almost identical with two exceptions. First, the logic analyzer does not measure the voltage of the input signal. This operation does not make sense here, since the signals of standard logic levels are examined. Secondly, the additional information displayed on the screen about the position of the information frame on the time axis in the logic analyzer mode is not superimposed on the area of ​​the oscillograms and does not interfere with their observation. Therefore, its shutdown is not implemented as unnecessary.

An example of the image on the indicator screen in the single sweep mode of the logic analyzer is shown in fig. 1.

New modes in the combined measuring instrument
Rice. 1. The image on the screen of the indicator in the single sweep mode of the logic analyzer

From the regular sweep mode of the analyzer, this mode is entered by pressing the "5" key. It has the following control keys:

"4" - move the frame to the left (to the beginning of the buffer);

"5" - stop moving along the signal counts;

"6" - move the frame to the right (to the end of the buffer);

"0" - selection of the movement step (count or frame);

"D" - exit from single sweep mode.

A complete description of the single sweep mode is not given, since it is quite fully described in [2] in relation to an oscilloscope.

As for the frequency measurement mode, the microcontroller of the ATxmega family allows you to implement several of its options. Along with the classical counting of the number of periods of the measured signal per unit of time, the timer-counters of this microcontroller are capable of directly measuring the repetition period of the input signal pulses, which makes it easy to calculate their repetition rate. The advantage of this method is the short measurement time, however, acceptable accuracy is maintained only up to a frequency not exceeding several tens of kilohertz. In this regard, the measurement of the signal frequency in the device is carried out by the classical method mentioned above.

Its principle is simple. One timer-counter generates a measuring time interval, the second counts the input signal pulses during this interval. If the duration of the measuring interval is 1 s, then the number accumulated during this time in the second counter is the signal frequency in hertz. However, there are difficulties in implementing this method.

Firstly, all timers-counters of the microcontroller of the ATxmega [3] family are 16-bit. This means that the maximum frequency correctly measured by such a counter is limited by the overflow of its counting register and is equal to 216 - 1 = 65535 Hz. This is clearly not enough, given that the elements of the microcontroller are operational up to a frequency of 32 MHz.

The easiest way to increase the maximum measurable frequency is to decrease the measurement interval. For example, reducing it by a factor of four will result in a fourfold increase in the maximum value of the measured frequency. At the same time, the discreteness of its measurement will increase by the same factor, because each pulse will "weigh" four times more. Therefore, this path is inappropriate.

It is possible to achieve an increase in the maximum measured frequency without increasing the measurement discreteness only by increasing the capacity of the input signal pulse counter. The architecture of the ATxmega microcontroller makes this possible by allowing several timers/counters to be connected in series. To get a 32-bit counter, it is enough to combine two 16-bit timer-counters. Overflow of a 32-bit counter per second can only occur at a frequency of 2 - 1 = 4294967295 Hz, so the upper limit of the measured frequency in this case is limited only by the frequency properties of the microcontroller elements and is equal to 32 MHz.

Secondly, it is necessary to "bring" the input signal from the port line to the timer-counter and force the latter to count pulses in a wide interval of their repetition rate.

Thirdly, it is necessary to ensure strictly synchronous operation of all microcontroller elements involved in the counting process, regardless of the operation of its other nodes, in order to avoid all sorts of unpredictable count failures.

A wonderful tool available in the ATxmega family of microcontrollers - the event system [4] - will help to overcome these difficulties. With its help, you can generate all the signals necessary for operation and transport them from the source to the receiver with the lowest possible and, most importantly, stable delay.

The functional diagram of the frequency meter implemented in the device under consideration is shown in fig. 2. The equipment of the input-output port allows you to analyze the state of each of its lines and generate events if they change. For example, to generate events for each rising or falling edge of the input signal. Timers-counters are able to count not only the internal clock pulses of the microcontroller, but also event signals. From this it becomes clear how the counting of the input signal pulses is organized.

New modes in the combined measuring instrument
Rice. 2. Functional diagram of the frequency meter implemented in the device under consideration

The signal is applied to the PF3 line, which is configured as an input and generates events on the rising edges of the signal (one event for each period). Timer-counter TCC1 operates in the event counter mode delivered on channel 3 of the event router. It also generates and sends overflow events (OVF) of its 4-bit counting register to router channel 16. They are counted by the TCD1 timer-counter, which is configured to operate as a 16-bit counter of events delivered on channel 4.

Once a second, at the end of the counting interval generated by the TCF0 timer-counter, configured to count the microcontroller synchronizer pulses, the program "glues" the results of the TCC1 and TCD1 counter timers into one 32-bit word and assigns its value to a variable. It then restarts all timers/counters, starting a new frequency measurement cycle.

Key Features in Frequency Measurement Mode

  • Measured frequency, Hz ...... from 1 to 32 106
  • Frequency readout resolution, Hz.......1
  • Duration of the counting interval, s ....... 1
  • The error of the duration of the counting interval, % .......±0,001

The main sources of frequency measurement error should be considered:

1. Inaccurate setting of the clock frequency of the microcontroller, as a result of which the actual duration of the measuring interval differs from one second. This error has two components: systematic and random.

The systematic component is the result of the inequality of the actual average value of the clock frequency to the nominal one. It is permanent and can be compensated for. How to do this will be discussed below.

The random component of the error arises due to fluctuations in the frequency of the clock generator. There are quite a few factors that give rise to it. These are instability and ripple of the supply voltage, intrinsic noise of the generator elements, the influence of temperature, etc. In high-end devices, a whole range of measures is used to minimize the harmful effects of such factors, up to thermal stabilization and vibration protection of the clock generator. However, this type of error can only be reduced, it cannot be completely eliminated. In the author's copy of the device, it does not exceed ± 0,001%. This means that the frequency of 5 MHz is measured with an error of ±50 Hz.

2. Discretization error of the measurement result. It is familiar to anyone who has ever dealt with any digital measuring instrument. The origin of this error is explained by the graphs in Fig. 3. Depending on the relative position on the time axis of the boundaries of the measuring interval and the measured signal drops recorded by the counter, the counting result may differ by one. For example, in the case shown in the figure, 6 or 7 pulses can be counted at an actual repetition rate of about 6,6 Hz (with a counting interval of 1 s). This effect is preserved at any ratio of the measured frequency and the counting interval. When a measurement is repeated many times, the least significant digit of its result "jumps" by one from cycle to cycle. The relative value of this error grows inversely with the measured frequency. For example, a frequency around 100 Hz will be measured with an average relative error of ±0,5%. At a frequency of several megahertz and higher, the sampling error can be neglected. Here, the random component of the duration of the measurement interval prevails.

New modes in the combined measuring instrument
Rice. 3. Graphs explaining the occurrence of the error

The program block that performs the frequency measurement was developed, like the entire program, in the BASCOM AVR programming system. When entering the frequency counter mode, the program appropriately sets up the elements of the microcontroller's internal structure involved in frequency measurement:

- PF3 line, which receives the input signal, is configured as an input that generates events on rising signal drops, and channel 3 of the event router is configured to transmit signals about these events:

Portf_pin3ctrl=1

Evsys_ch3mux=&B01111011

- configures the timer-counter TCF0 to generate a measuring interval with a duration of 1 s:

config Tcf0=Normal,Prescale=7

Tcf0_per=31249

- configures the TCC1 timer-counter to count events coming through the router channel 3 from the PF3 line:

config Tcc1=Normal

Tcc1_ctrla=&B00001011

Tcc1_ctrld=&B00001011

and channel 4 of the router - to signal the overflow of the timer-counter TCC1:

Evsys_ch4mux=&B11001000

- configures a timer-counter to count events coming from channel 4 of the router:

config Tcd1=Normal

Tcd1_ctrla=&w00001100

Tcd1_ctrld=&w00011100

As a result, the TCC1 and TCD1 timer-counters form a single 32-bit counter. The system is now ready to count the periods of the measured signal. Moreover, it is already underway, since each of the considered devices starts working immediately after initialization. But in order to get the correct result, it is necessary to start counting events from zero at the beginning of the measuring interval. Therefore, the measurement cycle should begin with the simultaneous zeroing of all three timers-counters participating in it.

It is especially important to bind to the beginning of the measuring interval (the moment of restarting the TCF0 timer) the restart moment of the TCC1 timer-counter operating at the highest speed. The issue of strict binding of the moment of restarting the timer-counter TCD1 to the beginning of the measuring interval is not so acute. The first event that it will have to count will only occur when the TCC1 timer-counter overflows.

Although the possibility of simultaneously restarting several timer-counters in the microcontroller is provided, it is implemented only through the event system. It cannot be used in the case under consideration, since the TCC1 timer-counter is configured to receive event signals from channel 3 and cannot receive event signals from other channels without reconfiguration. Therefore, only the processor can give the timer-counters a restart command, and only one by one.

The frequency measurement cycle consists of two stages: the actual measurement and the formation of its result. The measurement phase is described by the following five lines of the program:

Tcf0_ctrlfset=&B00001000

Tcc1_ctrlfset=&B00001000

Tcd1_ctrlfset=&B00001000

Bitwait Tcf0_intflags.0, Set

Evsys_ch3mux=&B00000000

The first three lines of this fragment restart the timer-counters in the order TCF0, TCC1, TCD1. Therefore, the TCC1 timer-counter starts counting events not at the start of the measurement interval counted by the TCF0 timer-counter, but with a delay Δt1 relative to this moment (Fig. 4). It is equal to the duration of the processor reset operation of the timer-counter TCC1. Next, with the same delay, the processor restarts the TCD1 timer-counter, after which it starts waiting for the end of the measuring interval. When this moment arrives, the TCF0 timer-counter will set the overflow interrupt request flag in the zero bit of the TCF0_JNTFLAGS register.

New modes in the combined measuring instrument
Rice. 4. The principle of operation of the timer-counter

Having detected this flag, the processor must prohibit the timer-counter TCC1 from further counting events (periods of the measured signal). This can be done in different ways. In our case, the last operation of the measurement step, the processor simply disables channel 3 of the event router. For this operation, he needs time Δt2 (Fig. 4), during which the counting of periods continues.

If Δt2 ≠Δt1, the actual duration of event counting (frequency measurement) differs by Δt2 - Δt1 from the given duration of the measurement interval, this generates another component of the measurement error. To eliminate it, it is necessary to make these delays equal. However, in a high-level language program (including BASCOM AVR), it is difficult to determine the exact values ​​of their duration, since the programmer does not know the algorithm for translating the used language constructs into machine commands. Therefore, in a real program, the fragments that restart the timer-counter TCC!, as well as fix the end of the measurement interval and stop TCC!, are written in assembly language, and measures are taken to ensure the same duration of execution of these fragments. This achieves the equality Δt2 = Δt1 and, consequently, the equality of the real duration of the measuring interval given.

Next, consider the method implemented in the device to eliminate the systematic error associated with the inequality of the microcontroller clock frequency to the nominal value. As noted above, the consequence of such a discrepancy is the deviation of the duration of the measuring interval from the required value of 1 s and the deviation of the measured frequency value proportional to it from the actual one.

First of all, this deviation must be measured. This will require an exemplary signal generator with a frequency of several megahertz or a set of any sufficiently stable generator and an exemplary frequency meter. The generator signal is fed to slots 8 and 3 (common) of connector X5 of the device.

The codes from the file Osc-Volt-2_03.hex attached to the article are loaded into the program memory of the microcontroller of the device. After switching on, the device is switched to the frequency counter mode and the frequency of the exemplary generator is measured by it. The measurement must be repeated 10-20 times, and then calculate the average measured value of the frequency Famended. The correction factor is calculated by the formula

K=Farr/Famended,

where Farr - frequency of the exemplary generator. To enter the coefficient K into the program, in the Osc-Volt-2_03.bas file (the source code of the program) you need to find the commented line

compensation: 'Temp2=Temp2*1.000004

It is labeled Compensation: to make it easier to find. It should be uncommented, and the multiplier 1.000004 (this value is valid for the author's copy of the device) should be replaced with the found value of the correction factor K. After that, it is necessary to compile the corrected program and load the codes from the resulting HEX file into the program memory of the microcontroller.

As already mentioned, the signal whose frequency must be measured is fed to socket 8 of the X5 connector of the device, from where it enters the microcontroller input PF3. It is clear that the microcontroller is able to correctly perceive only such a signal, the levels of which correspond to those accepted in three- or five-volt logic. To measure the frequency of signals of a different form (for example, sinusoidal), an additional driver is required. Good results are obtained by using the comparator probe described in [5]. It can be connected to the X5 socket of the instrument. You only need to submit from the A fee! device to the free slot 2 of this connector voltage +5 or +3,3 V to power the probe (it is operational at any of the specified voltage values). Connect the probe according to the diagram shown in Fig. 5.

New modes in the combined measuring instrument
Rice. 5. Probe connection diagram

The screen view of the instrument indicator in the frequency counter mode is shown in fig. 6.

New modes in the combined measuring instrument
Rice. 6. Screen view of the instrument indicator in the frequency counter mode

This mode is entered from the regular mode of the logic analyzer by pressing the "LA" key. Switch the device from the frequency counter mode to other modes by pressing the following keys:

"OS" - to the oscilloscope mode;

"LA" - to the logic analyzer mode;

"GN" - in the signal generator mode.

The microcontroller program can be downloaded from ftp://ftp.radio.ru/pub/2015/09/combi2-03.zip.

Literature

  1. Savchenko A. Improvement of the combined instrument based on the ATxmega microcontroller. - Radio, 2015, No. 3, p. 29-34.
  2. Savchenko A. Combined instrument based on ATxmega microcontroller. - Radio, 2014, No. 4, p. 18-22; No. 5, p. 22-25.
  3. Savchenko A. Means of generation, counting of impulses and time intervals in ATxmega. - Radio, 2015, No. 8, p. 25-28.
  4. Savchenko A. System of events of ATxmega microcontrollers. - Radio, 2015, No. 2, p. 24-27.
  5. Nechaev I. Probe-comparator for a frequency meter. - Radio, 2014, No. 7, p. twenty.

Author: A. Savchenko

See other articles Section Measuring technology.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

The world's tallest astronomical observatory opened 04.05.2024

Exploring space and its mysteries is a task that attracts the attention of astronomers from all over the world. In the fresh air of the high mountains, far from city light pollution, the stars and planets reveal their secrets with greater clarity. A new page is opening in the history of astronomy with the opening of the world's highest astronomical observatory - the Atacama Observatory of the University of Tokyo. The Atacama Observatory, located at an altitude of 5640 meters above sea level, opens up new opportunities for astronomers in the study of space. This site has become the highest location for a ground-based telescope, providing researchers with a unique tool for studying infrared waves in the Universe. Although the high altitude location provides clearer skies and less interference from the atmosphere, building an observatory on a high mountain poses enormous difficulties and challenges. However, despite the difficulties, the new observatory opens up broad research prospects for astronomers. ... >>

Controlling objects using air currents 04.05.2024

The development of robotics continues to open up new prospects for us in the field of automation and control of various objects. Recently, Finnish scientists presented an innovative approach to controlling humanoid robots using air currents. This method promises to revolutionize the way objects are manipulated and open new horizons in the field of robotics. The idea of ​​controlling objects using air currents is not new, but until recently, implementing such concepts remained a challenge. Finnish researchers have developed an innovative method that allows robots to manipulate objects using special air jets as "air fingers". The air flow control algorithm, developed by a team of specialists, is based on a thorough study of the movement of objects in the air flow. The air jet control system, carried out using special motors, allows you to direct objects without resorting to physical ... >>

Purebred dogs get sick no more often than purebred dogs 03.05.2024

Caring for the health of our pets is an important aspect of the life of every dog ​​owner. However, there is a common assumption that purebred dogs are more susceptible to diseases compared to mixed dogs. New research led by researchers at the Texas School of Veterinary Medicine and Biomedical Sciences brings new perspective to this question. A study conducted by the Dog Aging Project (DAP) of more than 27 companion dogs found that purebred and mixed dogs were generally equally likely to experience various diseases. Although some breeds may be more susceptible to certain diseases, the overall diagnosis rate is virtually the same between both groups. The Dog Aging Project's chief veterinarian, Dr. Keith Creevy, notes that there are several well-known diseases that are more common in certain breeds of dogs, which supports the notion that purebred dogs are more susceptible to disease. ... >>

Random news from the Archive

Peat batteries 22.10.2021

In Estonia, they learned how to process natural fuel into components of charging cells. The latest technology can solve the problem of the high cost of batteries and take a step towards affordable electric vehicles.

Picturesque Estonia in the north of Europe is almost a quarter covered with swamps. The country is very rich in peat deposits. Scientists from the University of Tartu have learned how to obtain the chemicals needed for electric batteries.

"There is a lot of peat in Estonia. Basically, we do not use it. Although it is suitable as a fertilizer and fuel for heating houses. We pass this peat through a double synthesis and make coal powder from it. Which is suitable for the production of sodium batteries," he said. Professor of Chemistry at the University of Tartu Anne Lust.

"We need cheap means to store huge amounts of electricity. The only way out is batteries. In particular, sodium-ion batteries, which are much cheaper than lithium ones," added Anne Lust.

The global demand for lithium is growing, and by 2025 it will reach 1 million tons per year. Leading automakers have already announced a full or partial transition to the production of electric cars from 2025.

The inventors call on the Estonian authorities to invest in a promising direction and allocate funds for the construction of a plant for the production of peat batteries. However, such batteries still have to be tested and prove their market and production feasibility. Only after that it will be possible to start mass production of available batteries.

Other interesting news:

▪ Smart door for cats and dogs

▪ Gardening is one of the best antidepressants

▪ Robot gardener

▪ Chemical synthesis against superbugs

▪ Multi-color marker Colorpik Pen

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ section of the site For a beginner radio amateur. Article selection

▪ Article In sound mind and solid memory. Popular expression

▪ article What code was set to launch American nuclear missiles in the 1960s and 70s? Detailed answer

▪ article Molokan compass. Legends, cultivation, methods of application

▪ article Loosely compensated volume control with a variable resistor without taps. Encyclopedia of radio electronics and electrical engineering

▪ article Microcasting at home. Encyclopedia of radio electronics and electrical engineering

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