1 Introduction
With the development of society, electricity consumption has increased. In order to improve electricity efficiency and improve the imbalance of electricity consumption, power departments in various provinces and cities in China have begun to fully launch multi-rate electricity meters. The task of multi-rate electricity meter calibration by measurement units has become increasingly arduous [1-2]. Clock accuracy is the most important part of time-sharing metering. The current method of multi-rate electricity meter clock calibration by measurement units has gradually failed to meet the needs. In order to solve the current problems in multi-rate electricity meter clock calibration, this paper designs a multi-rate electricity meter clock error analyzer system based on PIC microcontroller. This system is a portable clock error calibration device that integrates timing calibration, data processing, data transmission and other functions, and has the characteristics of fast, accurate and effective.
lFrequency measurement principle[3-4]
The system measures the frequency using a multi-cycle synchronous measurement method, which is developed on the basis of direct frequency measurement and is increasingly widely used in current frequency measurement systems. The gate time of the multi-cycle synchronous frequency measurement technology is not a fixed value, but a whole cycle of the measured signal, that is, synchronized with the measured signal, thus eliminating the ±1 word error caused by the count of the measured signal, greatly improving the measurement accuracy, and achieving equal precision measurement in the entire measurement frequency band.
The resolution of the multi-cycle synchronous measurement method is:
Daily timing error value: In the formula: Nx is the actual count value of the energy meter; Ns and fs correspond to the standard values of the energy meter. The system will eventually display the measured energy meter frequency and daily timing error value.
2 System Configuration
2.1 System Hardware Composition The system mainly consists of three parts: front-end circuit, main control circuit, display and communication part. The system composition block diagram is shown in Figure 1.
When the crystal oscillator is working, it will generate weak electromagnetic waves, and the frequency of the electromagnetic waves is consistent with the frequency of the crystal oscillation. The system first collects the crystal oscillator frequency signal, and then filters the collected signal through the filter amplifier circuit to remove high-frequency interference and low-frequency drift signals. At the same time, it also performs linear amplification to turn it into a sinusoidal signal with a regular waveform and appropriate amplitude, and then converts it into a digital signal through A/D conversion and enters: PIC microcontroller processing.
The system uses an improved dual-T type frequency selection network, which improves the Q value without affecting other parameters, and has a narrower passband width and a more significant passband effect. The specific method is: connect a common-phase proportional op amp in the feedback network as the load of the dual-T network. The circuit is shown in Figure 2.
The A/D conversion uses the ADS7826 chip, which is a dual 12-bit, 500 kHz analog-to-digital (A/D) converter with 6 fully differential input channels, which are divided into 3 pairs for high-speed synchronous signal acquisition. The input to the sample-and-hold amplifier is fully differential and remains differential until the input of the A/D converter. This provides a good common-mode rejection ratio of 80 dB at a frequency of 50 kHz, which is very important in a high-noise environment.
The processor used in this system is the PIC16F87X series microcontroller [5-7]. The PIC16F87X has three counters (Timer0, Timer1, Timer2) and a watchdog timer (watchdog TImer, WDT) inside. The structures and characteristics of these counters are not exactly the same. Specifically, in the case of this system, the approximate value of the signal frequency to be tested is 32768 Hz, and the reference frequency is 10 MHz. Therefore, the two counters TImer0 and Timerl inside the microcontroller are used. The reference frequency signal uses Timer1, and the signal to be tested uses Timer0. Timer0 is 8 bits, and the maximum count value is 256. Timerl is 16 bits, and the maximum count value is 65,536. Each needs an external 8-bit counter to meet the needs. The use of 74LS393 is a dual 4-bit binary counter that can increase the count to 24 bits.
The system uses a multi-cycle synchronous frequency measurement method. It is necessary to count the reference signal at the same time as the measured signal starts counting. When the measured signal is timed, the reference signal should also be stopped. This process can be achieved using the built-in CCP module of PIC16F87x. The CCP module refers to the capture/compare/pulse width modulation module ((2apturelC20mparelPWMmodule, CCP module), which can provide three functions: external signal capture, internal comparison output and PWM output. The capture and comparison functions are the same in basic operation mode. When used with a timer, capture refers to the state of the input signal on the detection pin. When the signal change matches the set condition (when the rising or falling edge of the signal appears), an interrupt is generated and the timer value at that time is recorded; comparison is to compare the pre-set value with the timer value. Once the two values are equal, an interrupt is generated and the pre-set action is driven; PWM is a signal with adjustable pulse width. The period (period) and duty cycle (duty cycle) of the pulse are generated by the internal timer comparison, so it also needs to be used with a timer.
The system display uses AY0438 to drive the 4-bit LCD display circuit. AY0438 is a complete CMOS display driver produced by MicroChip, which can directly drive the LCD display module under the control of a single-chip microcomputer or a microprocessor. It has a simple structure and is easy to use. Especially in driving a 32-segment LCD display, it can show its exquisiteness and convenience. AY0438 can continuously input drive signals to the LCD display connected to it using only 3 control lines. The device contains a 32-bit latch, which can latch the displayed data as well as the state or waveform of the microprocessor. The final frequency measurement result and daily error value of the system will be displayed by it.
2.2 System software composition
According to the functions it realizes, the software of the multi-rate electricity meter clock crystal error tester can be divided into the following functional modules:
(1) Timing verification part: The main function is to complete the signal acquisition, counting and calculation of daily timing error;
(2) Communication and display: The main function of communication is to complete the communication between the microcontroller and the host computer.
Step serial communication; the display function is to display the crystal frequency, timing error and other items on the LCD screen;
(3) Some other subroutines include watchdog, delay, protection program, etc.
The system flow chart is shown in Figure 3.
3 Conclusion
This paper uses this system to test different standard frequencies, and obtains the frequency measurement accuracy of the system: ±0.15 PPM, and the daily error accuracy is ≤10 ms. This system uses a multi-cycle synchronous measurement method to realize the design of a multi-rate electric energy meter error calibration instrument using a PIC microcontroller. It has the characteristics of small size, light weight, stable and reliable, easy to operate, and high measurement accuracy, and realizes the error calibration of multi-rate electric energy meters.
Previous article:PIC microcontroller realizes the design of 8 digital tubes to realize circular display
Next article:Design of reading and writing 9346EEPROM program by PIC microcontroller
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Introducing the TI C2000 stack evaluation method
- MicroPython's official documentation has been significantly adjusted
- DISP0_CONTRAST is used as GPIO to drive LED
- (Bonus 6) GD32L233 Review - Random Numbers (with software random number generation algorithm)
- Disassembly of a compact portable negative ion generator
- Half-bridge DC/DC power supply based on LM5036
- Share ESP8266smartconfig source code
- The voltage of HM1548 cannot be raised to 24V. I have tried 10UH inductor and 22UF capacitor, but they are not good. Can someone take a look at it?
- Live broadcast has ended: Watch the Thanksgiving live broadcast and win an oscilloscope | High-speed oscilloscope basics and Keysight's new oscilloscope analysis
- BlueNRG-1 LSM6DSL Direction Detection