Stairs.  Entry group.  Materials.  Doors.  Locks.  Design

Stairs. Entry group. Materials. Doors. Locks. Design

» A simple revolution counter - Designs of simple complexity - Schemes for beginners. Design Bureau online The simplest single-digit pulse counters

A simple revolution counter - Designs of simple complexity - Schemes for beginners. Design Bureau online The simplest single-digit pulse counters

This application example describes how to implement an electronic energy meter on the MSP430FE42x series microcontroller. The document contains a description of some fundamental principles and recommendations for using the MSP430FE42x series microcontrollers, as well as printed circuit board drawings and software demos.

1. Introduction

This application example describes the electrical circuit diagram and software of an electronic electricity meter on a microcontroller of the MSP430FE42x family. As a supplement, it is intended to use the ESP430CE1 module user manual.

The MSP430FE42x family of microcontrollers with integrated signal processor ESP430CE1 for single-phase energy meter with integrated analog input terminal and temperature sensor were designed specifically for use in power metering applications. The ESP430CE1 performs most power sensing tasks automatically, without using core resources. This allows you to save the resources of the computing core for use in other tasks, for example, for communicating with other devices. The ESP430CE1 can work with a variety of current sensors. It can use a Rogowski shunt, current transformers (CTs), including DC-coupled transformers with large phase shift, or inductors as a current sensor without additional external components. All parameters can be configured by software, and calibration constants can be saved in the MSP430 microcontroller's Flash memory and transferred to the ESP430CE1 upon system startup.

2 Hardware

The circuit board diagram and block diagram of the device are shown in Appendix A and are described in the following sections of this application example. The circuit board can be used with current transformers or shunts and can be rebuilt. This circuit board is available from Softbaugh and has order serial number DE427. You can order it on the Softbaugh company website, whose Internet address is www.softbaugh.com.

Connections of channels V1, I1 and I2 are shown in the diagram given in Appendix A.

2.1 Using a shunt as a current converter

Figure 1. Block diagram of connecting a shunt to a two-wire single-phase network

2.2 Using CT as a current converter


Figure 2. Block diagram of connecting CT to a two-wire single-phase network

2.3 Connecting CT and shunt as a current converter to detect tampering


Figure 3. Block diagram of connecting a shunt and CT to a two-wire single-phase network, allowing detection of unauthorized connection

2.4 CT connection for connection to three-wire single-phase networks used in the USA


Figure 4. ANSI block diagram of an electric meter used in three-wire single-phase networks

2.5 Connecting voltage sensor inputs

The printed circuit board is equipped with a voltage divider designed to operate in networks with a voltage of 230 V rms. It also contains a protection circuit designed for this voltage.

The capacitive power supply is capable of delivering current consumption up to 4 mA. It must be ensured that the current consumption does not exceed this permissible value. For this purpose, a low-current LED was used in the demonstration circuit.

2.6 Connecting current sensor inputs

There is space on the PCB to mount an SMD resistor used as a load for the current transformer, but this resistor is not installed on the supplied board. Note: The PT load resistor is not installed, but when connecting a PT, it must be installed, otherwise the MSP430 will be damaged.

2.7 Anti-aliasing filter

As an anti-aliasing filter, it is recommended to use a 1 kOhm resistor connected in series to the ADC input, and a 33 nF capacitor connected between the converter input and ground. To eliminate the influence of common-mode interference, it is recommended to use smoothing filters in both channels of the current converter.

2.8 Unused ADC channels

Unused ADC channels should not be connected to anything.

3 Calculation of constants for the ESP430CE1 meter

The meter requires constants that correspond to the transformers and/or shunts used. This section shows the calculation of constants for the ESP430CE1 meter.

3.1 Voltage conversion factor

The voltage conversion coefficient, according to which the actual input voltage is converted into the input voltage of the ESP430CE1 module, is calculated using the formulas below:

    V(inp.max) = VoltageGain x V (Line, Nom.) x sqrt(2) x R2 /(R1 + R2)
    kV1 = Voltage (Line, nominal) x 2 x sqrt(2) / (2 15 x (1- (Vref – V(inp.max) x 2)/Vref))

3.2 Current conversion coefficient for shunt

The current conversion coefficient for the shunt, according to which the actual input current is converted to the current of the ESP430CE1 module, is calculated using the formulas below:

    V(I, inp.max) = CurrentGain x Imax x R(Shunt) x sqrt(2)

3.3 Current conversion factor for current transformer

The current conversion coefficient for the current transformer, according to which the actual input current is converted to the current of the ESP430CE1 module, is calculated using the formulas below:

    V(I, inp.max) = CurrentGain x Imax / CTRatio x R(Burden) x sqrt(2)
    kI1 = Current (Line, nominal) x 2 x sqrt(2) / (2 15 x (1- (Vref – V(I, inp.max) x 2)/Vref))

3.4 Power interrupt level

The ESP430CE1 power chopping level is calculated using the following formula:

    InterruptLevel = Pulses/kWh x (1000 / 3600) x fADC / (kV1 x kI1 x 4096)

Pulses/kWh determines how many interrupts will be generated for each kWh.

4 Meter calibration

Calibrating an electronic electricity meter based on the MSP430 family microcontroller using conventional calibration equipment used to calibrate conventional electricity meters is possible, but ineffective. The processing power of the MSP430 allows you to do this in other ways, which are listed below.

Basic calibration can be initiated using the c0 command sent via UART. To run this command, you must define the input values ​​of the following parameters in the parameter.h file:

    -calVoltage
    - calCurrent
    - calPhi
    -calCosPhi
    - calFreq

Calibration of the phase shift between current and voltage must be performed with an accuracy of 0.5 degrees, since the phase shift error occurring in the sensors exceeds this value, so higher accuracy cannot be achieved.

To calibrate the electricity meter, it is necessary to separate the current and voltage measurement paths. This allows calibration to be performed with low energy losses and the values ​​of voltage, current and phase shift to be determined. Figure 5 shows the circuit diagram for turning on the electric meter during calibration.


Figure 5. Electronic energy meter on MSP430 with external terminals

4.1 Calibration for continuous measurement

The normal operating mode of the ESP430CE1 is established by sending the SetMode command to the computing core. The measured power value, written after each measurement into the ActEnSPer1 register (and into the ActEnSPer2 register for systems with two sensors), is converted by the computing core into a signal with a constant frequency, proportional to the measured power. To generate a signal with a constant frequency, the Timer_A timer module can be used.

During calibration, the following actions are performed:

  • The computing core sets the flags Curr_I1, Curr_I2, corresponding to the measurement mode, in the zero control register of ESP430CE1.
  • The parameter registers are initialized to measure the power in the load. This is done using the SET_PARAM command.
  • After receiving the mSet_Mode command, the ESP430CE1 enters electricity measurement mode.
  • The first measurement result located by ActEnSPer1 (and ActEnSPer2 in systems with two sensors) is not used because the starting point is unknown.
  • The following measurement results found in ActEnSPer1 (and ActEnSPer2 in systems with two sensors) are correct and are used for calculations.
  • The St_ZCld flag in the zero status register indicates that at the next available sample (St_NEVal flag is set), new measurement results for the previous period are available in the ActEnSPer1 and ActEnSPer2 registers.
  • The computing core resets the St_NEVal flag using the mCLR_EVENT command and reads the data (see the description of the reading algorithm below).
  • If necessary, for example, to calculate the result for a longer period, the last four points are repeated.

The above steps are repeated at the second calibration point.

Both sensors must be calibrated independently. When calibrating one sensor of the meter, the current through the second sensor should be zero. And vice versa.

4.1.1 Formulas

Calibration is performed over one main period (or nper main periods) at two load currents I1HI and I1LO. Nominal calculated power for two calibration points:

    nHIcalc = Cz1 x I1HI x V1 x cos?1 x (nper / fmains) x (fADC / 4096) [2 steps]
    nLOcalc = Cz1 x I1LO x V1 x cos?1 x (nper / fmains) x (fADC / 4096) [2 steps]

Resulting values ​​for tilt and offset:

    Slope: GainCorr1 = ((nHIcalc – nLOcalc) / (nHImeas – nLOmeas)) x 2 14
    Offset: Poffset = (((nHImeas x nLOcalc) – (nLOmes – nHIcalc)) / (nHImeas – nLOmeas)) x (fmains / nper) x (4096 / fADC),

where fmains is the fundamental frequency in Hz;

    fADC – ADC sampling frequency in Hz (usually 4096 Hz);
    nper – number of main periods used in calibration;
    nHIclac is the calculated power at the high current calibration point in squared steps;
    nHImaes – measured power at the high current calibration point in squared steps;
    nLOclac is the calculated power at the low current calibration point in squared steps;
    nLOmaes – measured power at the low current calibration point in squared steps;

4.1.2 Calibration example

For the circuit shown in Figure 1, calibration is performed under the following conditions:

    V1 = 230 V, I1HI= 20 A, I1LO = 1 A, cos?1 = 1, nper = 1, fADC = 2048 Hz, fmains = 50 Hz.
    nHIcalc = Cz1 x I1HI x V1 x cos?1 x (nper / fmains) x (fADC / 4096) = 29,322.80806 x 20 x 230 x 1 x (1 / 50) x (2048 / 4096) = 1,348,849.171 = 14.94F1h [ steps 2 ]
    nLOcalc = Cz1 x I1LO x V1 x cos?1 x (nper / fmains) x (fADC / 4096) = 29,322.80806 x 1 x 230 x 1 x (1 / 50) x (2048 / 4096) = 67,422.458 = 1.0772h [ steps 2 ]

Measurement result at both points:

    n1Himeas = 14.6040h (-1% error compared to n1Hicalc = 14.94F1h)
    n1Lomeas = 1.0CB7h (+2% error compared to n1Localc = 1.0772h)
    GainCorr1 = ((nHIcalc – nLOcalc) / (nHImeas – nLOmeas)) x 2 14 = ((14.94F1h – 1.0772h) / (14.6040h – 1.0CB7h)) x 2 14 = 40С0h

    Poffset = (((nHImeas x nLOcalc) – (nLOmes – nHIcalc)) / (nHImeas – nLOmeas)) x (fmeins / nper) x (4096 / fADC) = (((14.6040h x 1.0772h) – (1 .0CB7h – 14.94F1h)) / (14.6040h – 1.0CB7h)) x (50 / 1) x (4096 / 2048) = -215.489 = FFFC,B63Fh

If the calibration points are corrected for tilt and offset, then:

    ncorr = (nmeas x GainCorr1)) x 2-14 + (Poffset1) x (nper / fmains) x (fADC / 4096) nHIcorr = 14.6040h x 40C0h x 2-14 +FFFC,B63Fh x ((1 x 2048) / (50 x 4096)) = 1,348,890 = 14,951Ah nLOcorr = 1.0CB7h x 40C0h x 2-14 +FFFC,B63Fh x ((1 x 2048) / (50 x 4096)) = 67,441 = 1.0771h

The resulting error for both corrections is +3.1 E-5, i.e. 31 ppm.

4.2 Calibration using PC

Figure 6 shows one of the possible installation options for calibrating electronic electricity meters. The electricity meters are connected to the PC serial port via USART0 serial port operating in UART or SPI mode. All calculations necessary for calibration are performed by the PC, and the MSP430 of each electric meter only stores the resulting correction values ​​in the built-in data memory or external EEPROM memory.

The PC controls the calibration unit, consisting of a voltage generator, a current generator and a phase shifter, via a communication interface. The PC reads the results of the voltage and current multiplication calculated by the built-in ADCs (or the number of pulses Ws at the output of each electricity meter) and compares this value with the value obtained by the reference electricity meter, which is part of the calibration equipment. The PC calculates the error of the electric meter at one (for example, at rated current) or two (for example, at maximum and rated current consumption) calibration points. Based on the results of these errors, individual correction factors for the slope and offset angle are calculated and transmitted to a specific electric meter, in which the MSP430 microcontroller stores these values.


Figure 6. Calibration of electronic electricity meters using a PC

Formulas for calculating calibration constant values ​​are provided in the ESP430CE1 User's Manual.

4.3 Self-calibration

Another calibration method takes advantage of the MSP430's ability to perform complex calculations. The main advantage of this calibration method is its simplicity: No wired connections are required for data transfer with this method (see Figure 7). The error correction equations used by the meter during the test are the same as those given in the Continuous Measurement Calibration section above.

  • The meters to be calibrated are put into calibration mode using a hidden switch, UART, key, input pulse, etc.
  • The PC includes calibration equipment, which transfers a certain amount of energy, measured using a reference meter, to the electric meters being calibrated.
  • Electricity meters measure the amount of energy supplied and calculate the energy consumption value WEM1 for 100% of the rated current Inom.
  • After this, the calibration equipment is turned off (I = 0, U = 0). This allows the offset of the ADC itself to be calculated and measured if necessary.
  • The PC turns on the calibration equipment, which again supplies the electricity meters with a certain amount of electricity (for example, 5% Inom, 100% Vnom, cos?=1). After this, the equipment is turned off again (i = 0, U = 0).
  • The meters again measure the electricity and calculate the WEM0 value for 5% of the rated current Inom.
  • From the two values ​​WEM1 and WEM0 found for 100% and 5% of the rated current Inom, the electricity meters calculate the individual offset and slope values.
  • After calibration, you can perform a simple visual test:
    - to reset the indicators, the electricity meters are reset - the calibration equipment produces a precisely defined amount of energy (at different values ​​of current, voltage and cos?) - It is visually checked that all electricity meters display the same value of the measured value of the consumed energy - From the LCD readings it can be determined that the calculated coefficient tilt and displacement are outside acceptable limits.

Example: if you calibrate with the following parameters:

  • 10,000 Ws (100% Inom, 100% Vnom, cos? = 1)
  • 5,000 Ws (100% Inom, 100% Vnom, cos? = 0.5)

calibrated electricity meters must show a Ws value equal to 15,900 ± acceptable accuracy. If the calculated value is outside the acceptable limits, then the electricity meter is considered to have failed calibration.


Figure 7. Self-calibration of electricity meters

5 Capacitive power supply

Figure 8 shows a capacitive power supply that generates a single voltage Vcc = +3 V. If its output current is not enough, then an output buffer based on an NPN transistor can be used.

The design equations for the power supplies below are provided in Section 3.8.3.2 Capacitive Power Supply of the SLAA024 application example. This chapter describes other power supplies and the equations for calculating them.


Figure 8. Capacitive power supply

5.1 Line voltage off/on detection detector

Since the ESP430CE1 undervoltage detector is combined with a line voltage cycle counter, it does not work when there is a loss of line voltage. To detect this, you can monitor the VRMS for a certain period of time below a specified threshold, or use an external circuit to detect a loss of line power. When using an external circuit, you can turn off the ESP430CE1 module to reduce consumption.


Figure 9. Detecting the presence of line voltage

6.1 Grounding

Proper PCB routing is very important for systems using high resolution ADCs. Below are some basic guidelines for routing boards.

1. Use, whenever possible, separate analog and digital ground buses.

2. Maximum thickness of traces from the power supply to the DVSS, AVSS, DVCC, and AVCC pins.

3. Installing a capacitor at the convergence point of all analog ground lines. Installing a capacitor at the convergence point of all digital grounds.

4. Capacitor Cb should be located at the convergence point of all power rails. This is necessary to ensure the low impedance of this capacitor.

5. AVSS and DVSS terminals must be externally connected together.

6. AVCC and DVCC terminals must be externally connected together.

7. The power supply and storage capacitor Cb should be located as close to each other as possible. Capacitors Ca and Cb must be installed between the pins connected to the analog and digital power buses.

8. To decouple the analog and digital power rails, you must use an inductor L. You can also use a resistor, but using an inductor provides better high-pass filtering.

9. If there is a trace along the perimeter of the printed circuit board, then it must be connected to the board's ground bus.


Figure 10: A/D Converter Grounding

6.2 EMR sensitivity

Figure 11 shows in a simplified way a non-optimal routing: areas that can receive external interference from external EMR sources are highlighted in gray. To reduce the influence of external sources of EMR, these areas should be minimal.


Figure 11. Trace of a board sensitive to external EMI

Figure 12 shows a printed circuit board with optimal routing. The areas that are EMR receivers have a minimum area.


Figure 12. Trace of a printed circuit board with minimal sensitivity to EMI

7 Demo program

7.1 Initializing the analog terminal

When the ESP430CE1 module is disabled, the MSP430 Compute Core has access to the SD16 module. First, the MSP430 computing core must initiate an analog input terminal. In this case, the gain, sampling frequency and clock generator frequency for SD16 are set:

//================================================================ ==================== /** * Analog terminal initialization subroutine. * * Configuring a sigma-delta ADC module as an analog terminal for a tamper detection resistive * meter using a current transformer and shunt as a current sensor * (see setting up channels 0 and 1). */ void init_analog_front_end(void) ( /** * First checks that the on-chip signal processor is disabled, * otherwise it will not be possible to change the data in the SD16 register. * */ ESPCTL &= ~ESPEN; /** * After this the basic analog terminal settings, * which apply to all channels: selection of clock pulses (SMCLK), * divider parameters (depending on the frequency of SMCLK) and reference voltage */ SD16CTL= SD16SSEL_1 // Select clock pulses: SMCLK // SD16CTL = 0x800 + SD16SSEL_1 // Clock Clock selection: SMCLK + (Amp:) #if (MCLK_FREQ == 2) | SD16DIV_1 // division by 2 => ADC clock frequency: 1.094 MHz #endif #if (MCLK_FREQ == 4) | SD16DIV_2 // division by 4 => ADC clock frequency: 1.094 MHz #endif #if (MCLK_FREQ == 8) | SD16DIV_3 // division by 8 => ADC clock frequency: 1.094 MHz #endif | SD16REFON; // Using the built-in reference SD16CCTL0 = SD16INCH_0; / / I1 SD16CCTL1 = SD16INCH_0; // I2 SD16CCTL2 = SD16INCH_0; // V SD16CONF0 |= 0x70; // SD16CONF1 |= 0x68; // ADC clock delay 40 ns // =========================== ========================= /** * - ADC gain selection: * - VIN,MAX(GAIN = 1) = 0.5V > VCT(peak) * - VIN,MAX(GAIN = 2) = 0.25V< VCT(пиковое) * - VIN,MAX(GAIN = 16) = 0.031V >VShunt(peak) * - VIN,MAX(GAIN = 32) = 0.015V< VShunt(пиковое) */ // =================================================================== // Настройка нулевого канала аналогового терминала - Ток 1 SD16INCTL0= I1_Gain; // Установка коэффициента усиления для нулевого канала (I1) SD16CCTL0 |= SD16OSR_256; // Установка коэффициента дискретизации = 256 (по умолчанию) // =================================================================== // Настройка первого канала - Ток 2 SD16INCTL1= I2_Gain; // Установка коэффициента усиления первого канала (I2) SD16CCTL1 |= SD16OSR_256; // Установка коэффициента дискретизации = 256 (по умолчанию) // =================================================================== // Настройка второго канала - Напряжение SD16INCTL2= V_Gain; // Установка коэффициента (V) SD16CCTL2 |= SD16OSR_256; // Установка коэффициента дискретизации = 256 (по умолчанию) /** * \Замечание * Пожалуйста запомните, что коэффициент дискретизации для всех каналов должен * быть идентичным. По умолчанию он равен 256. */ } // Конец init_analog_front_end()

7.2 Electricity meter initialization

Before using the ESP430CE1, you need to configure it. Example of a module configuration routine:

//================================================================ ==================== /** * Initializing ESP430CE1. * */ void init_esp_parameter(unsigned char flashvars) ( volatile unsigned int timeout; // /\ Preventing "optimization" of variables. // Copying initialization values ​​to RAM if (flashvars) s_parameters = s_parameters_flash; /** * Check that the built-in signal processor * is activated, */ ESPCTL |= ESPEN; MBCTL = 0; /** * and is not in measurement or calibration mode, */ if ((RET0 & 0x8000) != 0) ( // Switch the embedded signal processor to mode "Idle" MBOUT1= modeIDLE; // ESP_IDLE; MBOUT0= mSET_MODE; timeout= 0xffff; while (((RET0 & 0x8000) != 0) && (timeout?? > 0)) ; ) /** * and ready to receive the message , requesting * the software version. */ MBOUT0= mSWVERSION; timeout= 0xffff; do ( while (((MBCTL & IN0IFG) == 0) && (timeout?? > 0)) ; if (timeout == 0) ( display_error (); return; ) ) while (MBIN0 != mSWRDY); firmware_version= MBIN1; // Write the program version. /** * After this, the parameters are initialized. * * Control 0: setting is performed for: * - Current measurement channel I2 ? detecting unauthorized connection * - Calculation of the absolute value of active energy * (negative energy is regarded as an unauthorized connection) * - Switching the algorithm to remove the DC component of current I1 * - Switching the algorithm to remove the DC component of current I2 */ set_parameter(mSET_CTRL0, defSET_CTRL0); /** * \setting the measurement number: * i.e. 4096 * 50Hz. => interrupt once per second */ set_parameter(mSET_INTRPTLEVL_LO, s_parameters.pSET_INTRPTLEVL.w); set_parameter(mSET_INTRPTLEVL_HI, s_parameters.pSET_INTRPTLEVL.w); /** * Nominal fundamental frequency: * i.e. 50 Hz. */ set_parameter(mSET_NOMFREQ, defSET_NOMFREQ); /** * Phase error correction: * Sets the phase error for current 1/2 of the rated fundamental frequency for * the current transformer according to its technical characteristics * Shunt phase error is zero. */ set_parameter(mSET_PHASECORR1, (int)s_parameters.pSET_PHASECORR1); set_parameter(mSET_PHASECORR2, (int)s_parameters.pSET_PHASECORR2); /** Setting parameters for two currents: * Current transformer: * * There are two options for setting the values ​​of two * currents: */ set_parameter(mSET_ADAPTI1, defSET_ADAPTI1); // = 1 * POW_2_14 = 16384 set_parameter(mSET_ADAPTI2, defSET_ADAPTI2); // = 1 * POW_2_14 = 16384 /** Setting the configured gain: */ set_parameter(mSET_GAINCORR1, s_parameters.pSET_GAINCORR1); set_parameter(mSET_GAINCORR2, s_parameters.pSET_GAINCORR2); /** Set the configured offset: */ set_parameter(mSET_V1OFFSET, s_parameters.pSET_V1OFFSET); set_parameter(mSET_I1OFFSET, s_parameters.pSET_I1OFFSET); set_parameter(mSET_I2OFFSET, s_parameters.pSET_I2OFFSET); // set_parameter(mSET_POFFSET1_LO, s_parameters.pSET_POFFSET1_LO); // set_parameter(mSET_POFFSET1_HI, s_parameters.pSET_POFFSET1_LO); /** The configured parameters become current: */ #if withStartCurrent == 1 set_parameter(mSET_STARTCURR_INT, s_parameters.pSET_STARTCURR_INT); set_parameter(mSET_STARTCURR_FRAC, s_parameters.pSET_STARTCURR_FRAC); #else set_parameter(mSET_STARTCURR_INT, 0); set_parameter(mSET_STARTCURR_FRAC, 0); #endif /** Adjustment parameters for the DC component removal period: */ set_parameter(mSET_DCREMPER, defSET_DCREMPER); ) // End of init_esp_parameter()) // End of subroutine init_esp_parameter()

7.3 Demo 1 program

Demo 1 is a simple demo program that initializes the ESP430CE1 to measure electrical energy and display the result on an indicator. This causes the LED to blink. This program can work with the Kickstart development kit from IAR.

Below are the demo program files and their purposes:

File Purpose and functions
Main.c Controls system initializations and calls functions to indicate the updated value requested by interrupt routines:
  • Init FLL and System Clock
  • Init Basic Timer and Real time Clock
  • Init LCD
  • Init analog front end
  • Init ESP430CE1 Parameters
  • Start Measurement
FET4xx_RTCwLCD.s43 Main subroutine for servicing LCD and RTC
Display.c High level subroutine for LCD
FLL.c PLL and clock system setup routine
PortFunc.c Port1 port interrupt processing subroutine
TimerA.c Subroutine for initializing and servicing the timer Timer_A. Timer_A is used to generate pulses
EMeter.c EMeter.c Contains initialization routine and maintenance routine for analog terminal, ESP430CE1 and interrupts from ESP430CE1
FE427_Measure_v3.ewp
FE427_Measure_v3.eww
Project files for Workbench version 3 from IAR
FE427_Measure.ewp
FE427_Measure.eww
Project files for Workbench version 2 from IAR
FE427_Measure.hzp
FE427_Measure.hzs
Project files for Rowley's CrossStudio program

Block diagram of the demonstration program is shown in Figure 13.


Figure 13. Block diagram of the demo program

7.4 Generating a power consumption pulse

This pulse can be used to indicate a certain level of energy consumption. Three methods can be used to generate this output signal.

7.4.1 Using the Level Interrupt Output Directly

The first method directly uses the ESP430 module's interrupt source output at a specified level. The implementation of this method is very simple and does not require the use of additional hardware or software resources. But due to the fact that the energy of sinusoidal oscillations is measured, this signal may have some transient oscillations.

This method is activated:

    // *define TIMERA_PULSE_OUTPUT
    // *define WITH_AVERAGING

7.4.2 Using Timer_A Timer Module Output

The second method uses a Timer_A timer module to remove transient oscillations. This method is suitable for generating pulses with a frequency of up to 30 Hz. Before using this method, you must make the following settings in the parameter.h file.

    *define TimerAClock TASSEL_1/* ACLK = 32 kHz
    *define TACLOCK 32768ul
    *define CLOCKSPERPERIOD (TACLOCK/defSET_NOMFREQ)

The method is activated as follows:

    *define TIMERA_PULSE_OUTPUT
    // *define WITH_AVERAGING

7.4.3 Using Timer_A Timer Module Output for Averaging

The third method uses only the Timer_A timer module to perform time averaging and generate carrier frequency pulses.

This method is activated as follows:

    *define TIMERA_PULSE_OUTPUT
    *define WITH_AVERAGING

7.5 Management

There are two buttons that are used to perform the following functions:

  • S_A: Turn off the ESP430CE1 module and put the MSP430 into low power mode. The real time clock continues to run.
  • S_B: Switching between display modes.

7.5.1 File Parameter.h

All configuration settings are made in the parameter.h file. These include:

  • Output pulse level.
  • Voltage and current transfer coefficients
  • Configuration parameters for ESP430CE1 module

#define for withDisplay allows the code to scale for different functions and sizes. The code uses floating point functions for UART output and calibration. Including one of these two parts will increase the code size.

The definition of a shunt, *define shunt, allows you to select what input I1 will be connected to - a shunt or a current transformer.

To simplify the calculation of the main parameters used in the parameter.h file, you can use the Excel file FE427_Settings.xls. After entering the required information in the white fields, all parameters will be calculated and displayed. By clicking the “Save Parameter to File” button, all parameters will be saved to the file ‘Test_Parameter.h’.

This file with the calculated parameters will be included in the source code instead of the default parameters specified in the 'Parameter.h' file if the remark is removed from the '#define Test' line in the 'Parameter.h' file itself.

7.6 Demo 2 demo program

The demo program Demo 2 is installed as a comprehensive application that includes a UART and some auto-calibration routines that save parameters to flash memory. To calculate power consumption, instead of the function of generating consumption when a specified level is exceeded, the values ​​returned by the ESP430CE1 module are used. The Demo 1 program initializes the ESP430CE1 module, outputs data to the indicator, and controls the power-on LED. This demo program is too large to be used with the IAR Kickstart kit.

Demo 2 includes all the files contained in Demo 1 and the files listed in the following table:

7.6.1 UART communication

    Transmitted data format: 57600 / 8 N 1
    Each command must end with the character "CR".
    The 'h' command displays the following help text in the terminal window:

    MSP430FE427 Software Version: 0114
    UART commands:

      SHxx: Setting the clock
      SMxx: Setting the minutes
      SSxx: Setting seconds
      SDxx: Setting the day
      SOxx: Setting the month
      SYxx: Setting the year
      Dx: Setting the indicator mode
      D1: Shutdown
      D2: Time
      D3: date
      D4: Voltage (V)
      D5: Current (A)
      D6: Peak Voltage (V)
      D7: Peak Current (A)
      D8: Frequency Hz)
      D9: CosPhi
      DA: Temperature
      DB: Power, kWt)
      DC: Power consumption (kW*h)
      H: show help text
      Tx: setting test mode
      R: system reset
      Mx: Perform test measurements for x*50 cycles
      I: Initialization
      C0: Auto calibration of U/I/P/phase shift
      C1: Interrupt Level Calibration
      C2: Phase correction calibration 1
      C3: Phase correction calibration 2
      C4: V1 offset calibration
      C5: I1 offset calibration
      C6: I2 offset calibration
      C9: Saving parameters in flash memory
      SA: Voltage Gain Calibration
      SV: Current Gain Calibration
      SS: Power Gain Calibration
      +: Increasing calibration value
      -: Decrease calibration value

7.6.2 Calibration

The main part of the calibration process can be performed using the UART command "C0".

To run this command, the input parameters must be defined in the parameter.h file:

  • calVoltage
  • calCurrent
  • calPhi
  • calCosPhi
  • calFreq

Using the UART command "C9" the calculated values ​​can be saved in flash memory.

7.6.3 Parameter.h file

All configuration settings are made in the parameter.h file:

  • Setting the output pulse level
  • Voltage and current coefficients
  • ESP430CE1 Module Settings

#defines for withUARTComm, withCalibration, withDisplay allow you to change the code for different functions and sizes. Including one of these two parts will increase the code size.

COUNTER ON THE MICROCONTROLLER

Many technical and automation devices still have mechanical counters installed. They count the number of visitors, products on the conveyor, turns of wire in winding machines, and so on. If it fails, it is not easy to find such a mechanical meter, and it is impossible to repair it due to the lack of spare parts. I propose to replace the mechanical counter with an electronic one using a PIC16F628A microcontroller.

An electronic counter turns out to be too complex if it is built on microcircuits of the K176, K561 series. especially if a reverse account is needed. But you can build a counter on just one chip - the universal PIC16F628A microcontroller, which includes a variety of peripheral devices and is capable of solving a wide range of tasks.

So recently a person asked me to make a multi-digit pulse counter. I decided against LED indicators because they take up a lot of space and consume a lot of energy. Therefore, I implemented the circuit on LCD. The counter on the microcontroller can measure input pulses of up to 15 digits. The first two digits are separated by a dot. EEPROM was not used because there was no need to remember the meter state. There is also a countdown function - reverse. Schematic diagram of a simple counter on a microcontroller:

The counter is assembled on two printed circuit boards made of foil fiberglass. The drawing is shown in the figure.

One of the boards has an LCD indicator, the other has 4 buttons, a controller and other parts of the meter, with the exception of the power supply. You can download the boards and the counter circuit in Lay format, as well as the microcontroller firmware on the forum. Material provided by Samopalkin.

2006

To calculate the electrical energy consumed over a certain period of time, it is necessary to integrate the instantaneous values ​​of active power over time. For a sinusoidal signal, power is equal to the product of voltage and current in the network at a given time. Any electric energy meter works on this principle.

2006

Installing and connecting an electric meter is not difficult. The panel with the meter must be installed on four rollers (at the corners of the panel) in the room, near the place where the electrical wiring from the common apartment meter passes

2012

This device monitors household electrical usage and records readings on an SD memory card. Simple analog amplifiers amplify the signal from voltage and current sensors, and based on the data received, the ATmega168 microcontroller calculates power consumption. Voltage and current are measured at 9615Hz, so readings should be accurate even on non-sinusoidal loads such as computers or fluorescent lamps.

The counter on the microcontroller is quite simple to repeat and is assembled on the popular PIC16F628A microcontroller with an indication output on 4 seven-segment LED indicators. The counter has two control inputs: “+1” and “-1”, as well as a “Reset” button. The control of the new counter circuit is implemented in such a way that no matter how long or short the input button is pressed, counting will continue only when it is released and pressed again. The maximum number of received pulses and, accordingly, ALS readings is 9999. When controlled at the “-1” input, the counting is carried out in reverse order to the value 0000. The counter readings are saved in the controller’s memory even when the power is turned off, which will save the data in the event of random interruptions in the supply voltage.

Schematic diagram of a reverse counter on the PIC16F628A microcontroller:

Resetting the counter readings and at the same time the memory state to 0 is carried out by the “Reset” button. It should be remembered that when you first turn on the reverse counter on the microcontroller, unpredictable information may appear on the ALS indicator. But the first time you press any of the buttons, the information is normalized. Where and how this circuit can be used depends on the specific needs, for example, installed in a store or office to count people or as an indicator for a winding machine. In general, I think that this counter on a microcontroller will be useful to someone.

If someone does not have the required ALS indicator at hand, but has some other one (or even 4 separate identical indicators), I am ready to help redraw the signet and redo the firmware. In the archive on the forum there is a circuit diagram, board and firmware for indicators with a common anode and a common cathode. The printed circuit board is shown in the figure below:

There is also a new firmware version for the counter on the PIC16F628A microcontroller. at the same time, the circuit and board of the meter remained the same, but the purpose of the buttons changed: button 1 - pulse input (for example, from a reed switch), button 2 turns on the counting for subtracting input pulses, while the leftmost point on the indicator lights up, button 3 - adding pulses - The rightmost point lights up. Button 4 - reset. In this version, the counter circuit on a microcontroller can be easily applied to a winding machine. Just before winding or unwinding turns, you must first press the “+” or “-” button. The meter is powered from a stabilized source with a voltage of 5V and a current of 50mA. If necessary, it can be powered by batteries. The case depends on your tastes and capabilities. Scheme provided by Samopalkin

Operating principle

The initial state is the zero level at all trigger outputs (Q 1 – Q 3), i.e. digital code 000. In this case, the most significant digit is the output Q 3. To transfer all flip-flops to the zero state, the inputs of the R flip-flops are combined and the required voltage level is applied to them (i.e., a pulse that resets the flip-flops). This is essentially a reset. Input C receives clock pulses that increase the digital code by one, i.e. after the arrival of the first pulse, the first trigger switches to state 1 (code 001), after the arrival of the second pulse, the second trigger switches to state 1, and the first to state 0 (code 010), then the third, etc. As a result, such a device can count up to 7 (code 111), since 2 3 – 1 = 7. When all the outputs of the triggers are set to ones, they say that the counter is overflowed. After the arrival of the next (ninth) pulse, the counter will reset to zero and everything will start from the beginning. In the graphs, changes in trigger states occur with a certain delay t h. At the third digit the delay is already tripled. The delay that increases with the number of bits is a disadvantage of counters with serial transfer, which, despite their simplicity, limits their use in devices with a small number of bits.

Classification of meters

Counters are devices for counting the number of pulses (commands) received at their input, storing and storing the counting result, and issuing this result. The main parameter of the counter is the counting module (capacity) Kс. This value is equal to the number of stable states of the counter. After the arrival of the Kc pulses, the counter returns to its original state. For binary counters Kс = 2 m, where m is the number of counter bits.

In addition to Kc, important characteristics of the meter are the maximum counting frequency fmax and the settling time tset, which characterize the speed of the meter.

Tst is the duration of the transition process of switching the counter to a new state: tset = mttr, where m is the number of digits, and ttr is the trigger switching time.

Fmax is the maximum frequency of input pulses at which pulse loss does not occur.

By type of operation:

– Summing;

– Subtractive;

– Reversible.

In a summing counter, the arrival of each input pulse increases the counting result by one, in a subtractive counter it decreases by one; In reversing counters, both summation and subtraction can occur.

By structural organization:

– consistent;

– parallel;

– series-parallel.

In a serial counter, the input pulse is supplied only to the input of the first digit; the output pulse of the preceding digit is supplied to the inputs of each subsequent digit.

In a parallel counter, with the arrival of the next counting pulse, switching of triggers upon transition to a new state occurs simultaneously.

The series-parallel circuit includes both of the previous options.

In order of state changes:

– with a natural order of counting;

– with an arbitrary counting order.

Modulo counting:

– binary;

– non-binary.

The counting module of a binary counter is Kc=2, and the counting module of a non-binary counter is Kc= 2m, where m is the number of counter bits.

Summing serial counter

Fig.1. Summing serial 3-bit counter.

The triggers of this counter are triggered by the falling edge of the counting pulse. The input of the high digit of the counter is connected to the direct output (Q) of the low adjacent digit. The timing diagram of the operation of such a counter is shown in Fig. 2. At the initial moment of time, the states of all flip-flops are equal to log.0, respectively, at their direct outputs there is log.0. This is achieved by means of a short-term log.0 applied to the inputs of asynchronous setting of flip-flops to log.0. The general state of the counter can be characterized by a binary number (000). During counting, logic 1 is maintained at the inputs of asynchronous trigger installation in log.1. After the arrival of the trailing edge of the first pulse, the 0-bit switches to the opposite state - log.1. The leading edge of the counting pulse appears at the 1-bit input. Counter status (001). After the falling edge of the second pulse arrives at the input of the counter, the 0-bit switches to the opposite state - log.0, and the falling edge of the counting pulse appears at the input of the 1-bit, which switches the 1-bit to log.1. The general status of the counter is (010). The next falling edge at the 0-bit input will set it to logic 1 (011), etc. Thus, the counter accumulates the number of input pulses arriving at its input. When 8 pulses arrive at its input, the counter returns to its original state (000), which means the counting coefficient (CFC) of this counter is 8.

Rice. 2. Timing diagram of a serial adding counter.

Subtractive serial counter

The triggers of this counter are triggered by the falling edge. To implement the subtraction operation, the counting input of the high-order digit is connected to the inverse output of the adjacent low-order digit. The triggers are preliminarily set to log.1 (111). The operation of this counter is shown in the timing diagram in Fig. 4.

Rice. 1 Serial subtractive counter

Rice. 2 Timing diagram of a serial subtractive counter

Reversible serial counter

To implement an up/down counter, it is necessary to combine the functions of a adding counter and the functions of a subtracting counter. The diagram of this counter is shown in Fig. 5. The “sum” and “difference” signals are used to control the counting mode. For the summation mode, “sum” = log.1, “0” is short-term log.0; “difference” = log.0, “1” - short-term log.0. In this case, elements DD4.1 and DD4.3 allow the supply of signals from the direct outputs of triggers DD1.1, DD1.2 to the clock inputs of triggers DD1.2, DD2.1 through elements DD5.1 ​​and DD5.2, respectively. In this case, the elements DD4.2 and DD4.4 are closed, there is a log 0 at their outputs, so the action of the inverse outputs does not in any way affect the counting inputs of the flip-flops DD1.2, DD2.1. Thus, the summation operation is implemented. To implement the subtraction operation, log.0 is supplied to the “sum” input, and log.1 to the “difference” input. In this case, elements DD4.2, DD4.4 allow signals from the inverse outputs of triggers DD1.1, DD1.2 to be supplied to the inputs of elements DD5.1, DD5.2, and, accordingly, to the counting inputs of triggers DD1.2, DD2.1. In this case, the elements DD4.1, DD4.3 are closed and the signals from the direct outputs of the triggers DD1.1, DD1.2 do not in any way affect the counting inputs of the triggers DD1.2, DD2.1. Thus, the subtraction operation is implemented.

Rice. 3 Serial up/down 3-bit counter

To implement these counters, you can also use triggers that are triggered by the rising edge of the counting pulses. Then, when summing, a signal from the inverse output of the adjacent low-order bit must be supplied to the counting input of the highest digit, and when subtracting, vice versa, the counting input must be connected to the direct output.

The disadvantage of a serial counter is that as the bit depth increases, the installation time (tset) of this counter increases proportionally. The advantage is ease of implementation.

Rice. 3 – Reversing counter

There are two inputs for counting pulses: “+1” – for increase, “-1” – for decrease. The corresponding input (+1 or -1) is connected to input C. This can be done using an OR circuit if you insert it in front of the first flip-flop (the output of the element is to the input of the first flip-flop, the inputs are to buses +1 and -1). The weird stuff between the triggers (DD2 and DD4) is called the AND-OR element. This element is composed of two AND elements and one OR element, combined in one housing. First, the input signals on this element are logically multiplied, then the result is logically added.

The number of inputs of the AND-OR element corresponds to the number of the digit, i.e. if the third digit, then three inputs, the fourth - four, etc. The logic circuit is a two-position switch controlled by the direct or inverse output of the previous trigger. At log. 1 at the direct output, the counter counts pulses from the “+1” bus (if they arrive, of course), with a log. 1 on the inverse output – from the “-1” bus. The AND elements (DD6.1 and DD6.2) form the transfer signals. At output >7, the signal is generated when code 111 (number 7) and the presence of a clock pulse on bus +1, at the output<0 сигнал формируется при коде 000 и наличии тактового импульса на шине -1.

All this, of course, is interesting, but it looks more beautiful in microcircuit design:

Rice. 4 Four-bit binary counter

Here is a typical preset meter. CT2 means that the counter is binary; if it is decimal, then CT10 is set; if it is binary-decimal, it is CT2/10. Inputs D0 – D3 are called information inputs and are used to write any binary state to the counter. This state will be displayed at its outputs and the countdown will begin from it. In other words, these are preset inputs, or simply presets. Input V is used to enable code recording on inputs D0 – D3, or, as they say, enable preset. This input may also be designated by other letters. Preliminary recording into the counter is made when a write enable signal is sent at the moment the pulse arrives at input C. Input C is clocked. Impulses are pushed here. The triangle means that the counter is triggered by the fall of the pulse. If the triangle is rotated 180 degrees, i.e. with its back towards the letter C, then it is triggered by the edge of the pulse. Input R is used to reset the counter, i.e., when a pulse is applied to this input, logs are set at all counter outputs. 0. The PI input is called carry input. The output p is called the carry output. A signal is generated at this output when the counter overflows (when all outputs are set to logic 1). This signal can be applied to the carry input of the next counter. Then, when the first counter overflows, the second one will switch to the next state. Outputs 1, 2, 4, 8 are simply outputs. They generate a binary code corresponding to the number of pulses received at the input of the counter. If the conclusions have circles, which happens much more often, then they are inverse, i.e. instead of log. 1 is given log. 0 and vice versa. The operation of meters together with other devices will be discussed in more detail later.

Parallel totalizer

The operating principle of this counter is that the input signal containing counting pulses is applied simultaneously to all bits of this counter. And setting the counter to log.0 or log.1 state is controlled by the control circuit. The circuit of this counter is shown in Fig. 6

Rice. 4 Parallel accumulating counter

The counter bits are triggers DD1, DD2, DD3.

Control circuit – element DD4.

The advantage of this counter is its short installation time, which does not depend on the digit capacity of the counter.

The disadvantage is the complexity of the circuit as the counter capacity increases.

Parallel carry counters

To increase performance, a method of simultaneously generating a transfer signal for all bits is used. This is achieved by introducing AND elements, through which clock pulses are sent immediately to the inputs of all bits of the counter.

Rice. 2 – Parallel carry counter and graphs explaining its operation

Everything is clear with the first trigger. A clock pulse will pass to the input of the second trigger only when there is a log at the output of the first trigger. 1 (a feature of the AND circuit), and to the input of the third - when there is a log at the outputs of the first two. 1, etc. The response delay on the third trigger is the same as on the first. Such a counter is called a parallel carry counter. As can be seen from the diagram, as the number of bits increases, the number of logs increases. AND elements, and the higher the rank, the more inputs the element has. This is a disadvantage of such counters.

Development of a schematic diagram

Pulse former

A pulse shaper is a device necessary to eliminate contact bounce that occurs when mechanical contacts are closed, which can lead to improper operation of the circuit.

Figure 9 shows diagrams of pulse formers from mechanical contacts.

Rice. 9 Pulse formers from mechanical contacts.

Display block

LEDs must be used to display the counting result. To carry out such output of information, you can use the simplest scheme. The diagram of the LED display unit is shown in Figure 10.

Rice. 10 LED display unit.

Development of CCS (combination control circuit)

To implement this counter from the TTLSh series of K555 microcircuits, I chose:

two K555TV9 microcircuits (2 JK triggers with installation)

one K555LA4 microcircuit (3 3I-NOT elements)

two K555LA3 microcircuits (4 2I-NOT elements)

one K555LN1 chip (6 inverters)

These chips provide a minimum number of packages on a printed circuit board.

Drawing up a block diagram of the meter

Block diagram is a set of meter blocks that perform some function and ensure normal operation of the meter. Figure 7 shows the block diagram of the meter.

Rice. 7 Block diagram of the meter

The control unit performs the function of sending a signal and controlling triggers.

The counting block is designed to change the state of the counter and save this state.

The display unit displays information for visual perception.

Drawing up a functional diagram of the meter

Functional diagram – internal structure of the meter.

Let's determine the optimal number of triggers for a non-binary counter with a counting coefficient Kc=10.

M = log 2 (Kc) = 4.

M = 4 means to implement a binary decimal counter, 4 flip-flops are needed.

The simplest single-digit pulse counters

The simplest single-digit pulse counter can be a JK flip-flop and a D flip-flop operating in counting mode. It counts input pulses modulo 2 - each pulse switches the trigger to the opposite state. One trigger counts up to two, two connected in series count up to four, n triggers count up to 2n pulses. The counting result is generated in a given code, which can be stored in the counter’s memory or be read by another digital decoder device.

The figure shows the circuit of a three-bit binary pulse counter built on a JK flip-flop ax K155TB1. Mount such a counter on a breadboard panel and connect LED (or transistor - with an incandescent lamp) indicators to the direct outputs of the triggers, as was done before. Apply a series of pulses with a repetition frequency of 1 ... 2 Hz from the test generator to the input C of the first trigger of the counter and plot the operation of the counter using the light signals of the indicators.

If at the initial moment all the triggers of the counter were in the zero state (you can set the button switch SB1 “Set.0”, applying a low level voltage to the input R of the triggers), then upon the decline of the first pulse (Fig. 45.6) the trigger DD1 will switch to single state - a high voltage level will appear at its direct output (Fig. 45, c). The second pulse will switch the DD1 trigger to the zero state, and the DD2-B trigger to the single state (Fig. 45,d). As the third pulse falls, triggers DD1 and DD2 will be in the one state, and trigger DD3 will still be in the zero state. The fourth pulse will switch the first two triggers to the zero state, and the third to the single state (Fig. 45, d). The eighth pulse will switch all triggers to the zero state. When the ninth input pulse falls, the next cycle of operation of the three-digit pulse counter will begin.

Studying the graphs, it is easy to notice that each high digit of the counter differs from the low digit by twice the number of counting pulses. Thus, the period of the pulses at the output of the first trigger is 2 times greater than the period of the input pulses, at the output of the second trigger - 4 times, at the output of the third trigger - 8 times. Speaking in the language of digital technology, such a counter operates in a 1-2-4 weight code. Here, the term “weight” refers to the amount of information received by the counter after setting its triggers to the zero state. In devices and instruments of digital technology, four-digit pulse counters operating in the weight code 1-2-4-8 are most widely used. Frequency dividers count the input pulses to a certain state specified by the counting coefficient, and then form a trigger switching signal to the zero state, again begin counting the input pulses to the specified counting coefficient, etc.

The figure shows the circuit and graphs of the operation of a divider with a counting factor of 5, built on JK flip-flops. Here, the already familiar three-bit binary counter is supplemented with a logical element 2І-NOT DD4.1, which sets the counting factor of 5. It happens like this. During the first four input pulses (after setting the triggers to the zero state using the SB1 “Set 0” button), the device operates as a regular binary pulse counter. In this case, a low voltage level operates at one or both inputs of element DD4.1, so the element is in a single state.

Upon the decline of the fifth pulse, a high voltage level appears at the direct output of the first and third triggers, and therefore at both inputs of the DD4.1 element, switching this logical element to the zero state. At this moment, a short low-level pulse is formed at its output, which is transmitted through the diode VD1 to the R input of all flip-flops and switches them to the initial zero state.

From this moment the next cycle of the counter operation begins. Resistor R1 and diode VD1, introduced into this counter, are necessary in order to prevent the output of element DD4.1 from being shorted to the common wire.

You can check the operation of such a frequency divider by applying pulses with a frequency of 1 ... 2 Hz to the input C of its first trigger, and connecting a light indicator to the output of the DD3 trigger.

In practice, the functions of pulse counters and frequency dividers are performed by specially designed microcircuits with a high degree of integration. In the K155 series, for example, these are counters K155IE1, K155IE2, K155IE4, etc.

In amateur radio developments, the K155IE1 and K155IE2 microcircuits are most widely used. Conventional graphic symbols of these counter microcircuits with the numbering of their outputs are shown in Fig. 47.

The K155IE1 microcircuit (Fig. 47a) is called a ten-day pulse counter, that is, a counter with a counting factor of 10. It contains four triggers connected in series. The output (pin 5) of the microcircuit is the output of its fourth trigger. All flip-flops are set to the zero state by applying a high-level voltage simultaneously to both inputs R (pins 1 and 2), combined according to the AND element circuit (symbol “&”). Counting pulses, which must have a low level, can be applied to inputs C connected together (pins 8 and 9), also combined along I., or to one of them, if at this time the second has a high voltage level. With every tenth input pulse, the counter generates a low-level pulse equal in duration to the input pulse. Microcircuit K155IE2 (Fig. 48b)

Binary-decimal four-digit counter. It also has four flip-flops, but the first one has a separate C1 input (pin 14) and a separate direct output (pin 12). Three other triggers are connected to each other so that they form a divider by 5. When the output of the first trigger (pin 12) is connected to the input C2 (pin 1) of the circuit of the remaining triggers, the microcircuit becomes a divider by 10 (Fig. 48, a), operating in code 1 -2-4-8, which is what the numbers at the outputs of the graphic designation of the microcircuit symbolize. To set the counter triggers to the zero state, a high level voltage is applied to both inputs R0 (pins 2 and 3).

Two combined inputs R0 and four separating outputs of the K155IE2 microcircuit allow you to build frequency dividers with division factors from 2 to 10 without additional elements. For example, if you connect pins 12 and 1, 9 and 2, 8 n 3 (Fig. 48, 6), then the counting factor will be 6, and when connecting pins 12 and 1, 11. 2 and 3 (Fig. 48, c) the counting factor will become 8. This feature of the K155IE2 microcircuit allows it to be used both as a binary pulse counter and as a frequency divider.

A digital pulse counter is a digital unit that counts the pulses arriving at its input. The counting result is generated by the counter in a given code and can be stored for the required time. Counters are built on triggers, and the number of pulses that the counter can count is determined from the expression N = 2 n – 1, where n is the number of triggers, and minus one, because in digital technology 0 is taken as the starting point. Counters are summative when the count goes towards increase, and the subtractive count goes towards decrease. If the counter can switch during operation from summation to subtraction and vice versa, then it is called reversible.