Design of clock error analyzer system for multiple rate electric energy meter based on PIC single chip

Publisher:平稳心绪Latest update time:2019-12-31 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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:

Design of clock error analyzer system for multiple rate electric energy meter based on PIC single chip

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.

Design of clock error analyzer system for multiple rate electric energy meter based on PIC single chip

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.

Design of clock error analyzer system for multiple rate electric energy meter based on PIC single chip

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.

Design of clock error analyzer system for multiple rate electric energy meter based on PIC single chip

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.

Reference address:Design of clock error analyzer system for multiple rate electric energy meter based on PIC single chip

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

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号