Full mix timer. World of Tanks "gun aiming timer". - added improved option

Lecture No. 5

TIMERS-COUNTERS

General information

Any AVR series microcontroller contains several built-in timers. Moreover, according to their purpose, they can be divided into two categories. The first category includes general purpose timers. The second category is the watchdog timer. The watchdog timer is designed to automatically restart the microcontroller if its program freezes.

Definition. A freeze is a program loop that occurs as a result of an error made by the programmer or as a result of external interference.

Each chip requires only one watchdog timer. Any AVR microcontroller has such a timer.

Purpose: General purpose timers are used to generate various time intervals and rectangular pulses of a given frequency. In addition, they can operate in counter mode and count clock pulses of a given frequency, thus measuring the duration of external signals, and also, if necessary, count the number of any external pulses.

For this reason, these timers are called "timers/counters". AVR chips use both eight-bit and sixteen-bit timers/counters. Their number for different microcontrollers varies from one to four. All timers are designated by numbers from 0 to 3.

Example. TiTer/CouPter0, Timer/CouPter1 And T. d. In Russian-language literature they are more often called abbreviated T/S0, T/S1, T/S2, T/SZ. Timers T/C0 and T/C2 in most microcontrollers- eight-bit. Timers T/S1 and T/SZ- sixteen-bit. Timer T/C0 is available in any AVR chip. The rest are added as the model becomes more complex.

Each eight-bit timer represents one eight-bit register, which for the microcontroller is an I/O register. This register stores the current timer value and is called the counting register. Sixteen-bit timers have a sixteen-bit counting register. Each counting register has its own name.

The counting register of an eight-bit timer is called TCNTx, where “x” is the timer number. For the T/C0 timer, the register is called TCNT0. For timer T/C2 - TCNT2. Sixteen-bit registers are named similarly. The difference is that each sixteen-bit counter register for the microcontroller represents two I/O registers. One is for storing the most significant bits of a number, and the second is for storing the least significant bits. The letter H is added to the name of the register of the most significant bits, and the letter L is added to the register of the least significant bits. Thus, the counting register of the T/C1 timer is two input-output registers: TCNT1H and TCNT1L.

The counting register of the T/C3 timer is two registers TCNT3H and TCNT3L.

The microcontroller can write any number to any counting register at any time, and can also read the contents of any counting register at any time. When the timer is switched on to counting mode, counting pulses begin to arrive at its input. After the arrival of each such pulse, the contents of the counting register are increased by one. Counting pulses can serve as special clock pulses generated inside the microcontroller itself, as well as external pulses arriving at special inputs of the microcircuit. When the counting register overflows, its contents are reset to zero and counting starts over.

Any timer is tightly tied to the interrupt system. A number of timer-related events can cause an interrupt. For example, there is a timer overflow interrupt, when a special matching circuit is triggered. The watchdog timer can cause individual interrupts.

Timer/Counter Prescalers

As mentioned earlier, each microcontroller timer can operate from two different clock sources. Either these are external pulses or pulses generated by the internal circuitry of the microcontroller. Whatever signal source is selected, this signal passes through a prescaler circuit before entering the timer input. The prescaler is designed to expand the range of generated frequencies and timer durations. Each AVR chip has its own prescaler structure for timers/counters. A simplified diagram of one of the variants of the preliminary divider is shown in Fig. 5.1.

As can be seen from the above diagrams, a 10-stage divider and multiplexers are integrated into the microcontrollers, connecting the corresponding output of the divider to the input of the counters.

The signals CLK/8, CLK/64, CLK/256 and CLK/1024 are removed from the divider outputs. The circuit contains circuits through which external pulses T0 and T1 can be supplied to the timer input.

In the “Counter” operating mode, the falling or rising edge of an external pulse at inputs T0 and T1 can be selected as an active edge using a multiplexer. In this mode, the external signal T0 (as well as T1) is synchronized with the system clock clock CLK of the internal quartz oscillator. To do this, the external signal is checked during each rising edge of CLK (Fig. 5.2).

In Fig. Figure 5.2 shows the various signals synchronized by the CLK signal, noting that only the A signal is synchronized without loss of information. This must be taken into account when choosing the operating frequency of the MC.

All counting signals are supplied to the data inputs of the multiplexer. The address inputs of the multiplexer receive signals from three bits of the timer control register (TCCRn).

Thus, by writing different values ​​into the CSn0, CSnl, CSn2 bits, you can select one of eight operating modes of the prescaler. Depending on the selected mode, the output of the circuit can receive a signal from one of the outputs of a ten-bit divider, a direct signal from a clock generator, or a zero logical level (input D0). In the latter case, there will be no signal at the timer input, and its operation is suspended.

Description

Clock source not selected. (Counter stopped).

clk I / O /1 (No pre-division).

clk I / O /8 (Clock signal from the limit divider).

clk I / O /64 (Clock signal from the limit divider).

clk I / O /256 (Clock signal from the limit divider).

clk I / O /1024 (Clock signal from the limit divider).

External clocking from Tn pin. Tick ​​on the falling edge of the signal.

External clocking from Tn pin. Tick ​​on the rising edge of the signal.

Here the value clk I / O denotes the processor clock frequency.

Thus, the prescaler circuits provide the following eight different options for generating counting pulses:

    0 - lack of impulses;

    1 - “timer”, direct signal from the internal generator;

    2...5 - “timer”, one of the signals from the divider;

    6 - “counter”, inverse signal from external input (active

falling front);

    7 - “counter”, direct external signal (active increasing

The diagram shown in Fig. 5.1 is not a standard for all AVR series microcontrollers. It reflects only the general principle of constructing prescalers. This is done slightly differently in different models.

As already noted, the clocking method is determined by the CSn2:0 (Clock Select) bits located in the TCCRnB control register.

16-bit timer/counter.

Let's take a closer look at the ATmega 128 timer/counter circuit using the example of 16-bit timer/counter 1. It has an identical structure to timer/counter 3.

The block diagram of timer/counter 1 is shown in Fig. 5.3. The letter “x” indicates the number of the timer/counter in question (x=1).

Rice. 5.3 . Block diagram of timer/counter 1, 3 MKATmega 128.

Timer/Counter 1 contains a basic counter TCNT1H:TCNT1L (Timer/Counter 1), which has sixteen bits. When a clock signal arrives at the input of the counter circuit, the value of the base counter, depending on the selected operating mode, is incremented or decremented. In addition, the timer-counter includes control registers TCCR1A, TCCR1B, TCCR1C (Timer/Counter 1 Control Register), two bits of the request register, TIFR interrupts and the same number of bits of the TIMSK interrupt masking register. The TIFR and TIMSK registers are common to all microcontroller timer-counters.

The TIFR (Timer/Counter Interrupt Flag Register) bit is set to one when a specific interrupt request is generated in the timer-counter. In the interrupt mask register TIMSK (Timer/Counter Interrupt Mask Register), enable/disable interrupts of timer/counter 1 are set. The TIFR register bit is reset to zero in hardware when the microcontroller transitions to executing the corresponding interrupt program or in software when executing a command to set the bit to the one state.

The timer/counter that performs the comparison function or PWM includes the comparison registers OCR1АH:OCR1АL, OCR1BH:OCR1BL, OCR1CH:OCR1CL (Output Compare Register), and the timer/counter that performs the capture function includes the capture register ICR1H:ICR1L ( Input Capture Register). The width of the OCR1 and ICR1 registers is equal to the width of the base counter TCNT1.

The 16-bit timer/counter 1 can receive a clock signal from CLK, CLK after the prescaler, and from an external pin. Moreover, it can be stopped. With external clocking of Timer/Counter 1, the external signal is synchronized to the CPU clock frequency.

16-bit Timer/Counter 1 provides the best accuracy and resolution with the lowest prescale ratio. On the other hand, a high prescale factor is useful when Timer/Counter 1 implements low-speed functions or accurately synchronizes infrequently occurring actions. Timer/Counter1 supports output comparison functions using the Output Compare Registers A, B, and C - OCR1A, OCR1B, OCR1C - as data sources that are compared with the contents of Timer/Counter 1.

Timer/Counter 1 can be used as an 8, 9, or 10-bit pulse width modulator. In this mode, the counter and registers OCR1A/OCR1B/OCR1C operate as dual independent PWM with centered pulses, without generating false pulses.

The Timer/Counter 1 Input Capture function captures the contents of Timer/Counter 1 into an input capture register triggered by an external event on the capture input pin of IC1. The actual event capture settings are determined by Timer/Counter Control Register 1 TCCR1B. Additionally, an analog comparator can be used to switch the capture input. If noise suppression is enabled, the actual triggering conditions of the capture event are tested with four samples before the capture is activated. The signal at the input pin is tested at the clock frequency of the MK core.

We present to you new mod, thanks to which you can add to any sight additional features, for example, gun aiming time.

Features of the modification

  • Displays information near the sight about how much time is left until the gun is fully aimed. This information will be especially useful for players who prefer to play ART-SAU. But it can also be useful for fans of other classes.
  • In addition to the timer, the scope spread is also shown. this moment in meters.
  • For all vehicle classes, it is shown exactly how long the projectile will fly to the target.
  • In this special config, other features are activated, for example, the speed of movement of the target, as well as its name. In addition, the distance to the enemy vehicle and the accuracy of the player’s tank are shown.
  • A configuration file called extra_aiminfo.json will help you configure the modification the way you want it. You can turn data on/off or change the location of the information window.
  • One of the main features is the integration of the mod with any mod, ranging from simple standard mixing to super-developed options. And if in custom sight There is already duplicate data, the settings file will help.

How to install the mod?

Copy the configs folder to \World_of_Tanks\mods\. Copy the remaining folders and files to World of Tanks\mods\1.4.


New and pretty interesting mod Gun aiming timer for WOT 0.9.15. Now you will always know exactly three parameters of the weapon:

  1. gun aiming time in seconds;
  2. scatter depending on how much you are reduced;
  3. projectile flight time for both artillery and simple tanks;

Now you can always know how much time you have left until the gun is fully aimed and what the spread will be if you fire before it ends. This information will help you more accurately assess the situation and successfully carry out attacks. Also, the convergence timer mod will be useful for most art in which there is no projectile flight time. Overall the mod has fairly good utility in combat.

It, like most modern mods, has a settings file with which you can configure what information is displayed and what is not, change the font and color of the text. It is located at this path: WOT\res_mods\0.9.15\scripts\client\mods\extra_aiminfo.json and looks like this:

{
"TextArea_Style": (
"x": -200, - X coordinates;
"y": 100, - Y coordinates;
"width": 600, - width;
"height": 300, - height;
"hcentered": true, - horizontal alignment to the center;
"vcentered": true, - vertical alignment to the center;
"background": "extra_aiminfo_bg.dds", - background file under the text;
"font": "default_medium.font", - names of the font for output;
"visible": true, - output is enabled or disabled;
"color": "#FFFFFF" - text color;
},
"format": "Dimension:((aimTimeRemain))s\r\nDispersion:((deviation))m\r\nFlight Time:((flyTime))s" - information output line with macros (for available ones, see the archive in the file macros.txt);
"StrategicOnly": false - enable/disable the mod to work only in the art sight;
}

FAQ.

Q: How can I leave only the mixing time?

A: If you only need to display the mix timer, then you need to edit the "format": line so it looks like this: "format": "Mix:((aimTimeRemain))s". Do the same with any other output field; you can remove or add it. See the file macros.txt for the entire list of available macros.

Q: How can I make the font smaller or larger?

A: If you need to make the font smaller or larger, use the WOT system fonts from the list below:

Default_medium.font
default_smaller.font
default_small.font
hpmp_panel.font
system_large.font
system_medium.font
system_small.font
system_tiny.font
verdana_medium.font
verdana_small.font

Select the one you need and enter it here “font”: “default_medium.font”, for example, you selected the font default_smaller.font, then your font settings line should look like this: “font”: “default_smaller.font”.

Q: How can I change the location of the mixdown timer?

A: To change coordinates in the improved version, in addition to x,y, you also need to change width and height. Experiment and adjust the width and height to the coordinates. So far this is the only way, the author of the mod “which original to look for” and it didn’t work out to make a normal change of location.

In the standard one, just change x and y until you move the mod to the right place.

In the original version, this is more complicated, so try not to change x and y in it.

Q: How can I display the information timer and projectile flight time only in art mode? (Works only in the original and improved version!)

A: In the improved version of the mod, an option was added in the settings "StrategicOnly": false, if you need the mod to work only in the art sight, change false to true. Do the same with the original version, only change the values ​​of the "spgonly":false field.

Q: How can I remove the dark background under the timer text?

A: To remove the background, open the mod settings file using NotePad++ and delete the line "background": "extra_aiminfo_bg.dds",.

Installation:

Copy files from folder extra_aiminfo.zip from the archive along the path World_of_Tanks\res_mods\0.9.15\

While analyzing the needs of tankers for mods, we came across requests for a gun aiming timer and began looking for a mod to solve this problem. The WotSite.Net team has finally found a gun aiming timer mod for WOT 0.9.14, which, regardless of what kind of sight you have or whether it is installed at all, will display the following information on the screen:

  • gun aiming time in seconds;
  • scatter depending on how much you are reduced;
  • projectile flight time for both artillery and simple tanks;

We present to your attention a completely redesigned and improved information timer from the original author of this mod. The mod was rewritten from scratch and supplemented with new features. Now the text displaying information has become more readable.

Added the ability to enable timer displays for certain events, for example, target acquisition, additions additional information when aiming at a target and so on. Soon the author will add an option to display the mix timer only in art mode, but for now it is only available in old version. It looks like this now:

Oddly enough, having installed this option, we did not notice any drop in FPS. In addition, it adds the following features that are not present in the 2 previous versions:

  • the total aiming time after the last movement of the gun (that is, you converged, pulled the gun, and the second number in the aiming timer will show you the total aiming time after the last movement of the gun. It will be different each time, because one time you can greatly confuse the aim, the second time less and etc.)
  • the speed of movement of the target that is in your sight
  • new accuracy indicator
  • ability to edit displayed text using HTML tags

Now you can always know how much time you have left until the gun is fully aimed and what the spread will be if you fire before it ends. This information will help you more accurately assess the situation and successfully carry out attacks. Also, the aiming timer mod will be useful for most art sights that do not have projectile flight time. Overall the mod has fairly good utility in combat.

It, like most modern mods, has a settings file with which you can configure what information is displayed and what is not, change the font and color of the text. It is located along this path: WOT\res_mods\0.9.14\scripts\client\gui\mods\mod_ExtraAimInfo.json, in it you can configure the following:

  • type of aiming timer in each sight mode ("TextFlashArcade" - arcade, "TextFlashSniper" - sniper and "TextFlashStrategic" - art sight);
  • enabling the timer to be turned off in each of these modes ("enable": true or "enable": false);
  • configure the appearance, size, font, shadow, text color ("text" block: () and "shadow" block: ());
  • insert any picture as a background for the text (block "background": () for each sight separately);

FAQ.

IN: How to leave only the mixing time?

ABOUT: If you only need to display the convergence timer, then you need to edit the line "format": so that it looks like this: "format": "Mix:((aimTimeRemain))s". Do the same with any other output field; you can remove or add it. See the file macros.txt for the entire list of available macros.

IN: How to make the font smaller or larger?

ABOUT: If you need to reduce or increase the font, find the next line size="16" and write a smaller number there, if you need to increase it, then a larger one.

IN: How to change the location of the mixing timer?

ABOUT: WITH latest updates fashion, you can move the timer around the screen by holding left CTRL and pressing the arrows up, down, right, left.

IN: How can I display the information timer and projectile flight time only in art mode?

ABOUT: Open the mod settings file, find "TextFlashArcade": ( further, a little lower, "enable": true and replace true with false there. Do the same with "TextFlashSniper": (.

IN: How to add a background below the timer text?

ABOUT: Each setting section has its own “background” block: () this is where you can add backgrounds in the form of pictures under the text.

We present to you a new mod, thanks to which you can add additional features to any sight, for example, gun aiming time.

Features of the modification

  • Displays information near the sight about how much time is left until the gun is fully aimed. This information will be especially useful for players who prefer to play ART-SAU. But it can also be useful for fans of other classes.
  • In addition to the timer, the current spread of the sight in meters is also shown.
  • For all vehicle classes, it is shown exactly how long the projectile will fly to the target.
  • In this special config, other features are activated, for example, the speed of movement of the target, as well as its name. In addition, the distance to the enemy vehicle and the accuracy of the player’s tank are shown.
  • A configuration file called extra_aiminfo.json will help you configure the modification the way you want it. You can turn data on/off or change the location of the information window.
  • One of the main features is the integration of the mod with any mod, ranging from simple standard mixing to super-developed options. And if the custom scope already has duplicate data, the settings file will help.

How to install the mod?

Copy the configs folder to \World_of_Tanks\mods\. Copy the remaining folders and files to World of Tanks\mods\1.4.



Backgammon