Frequency measurement based on 80C196 and its application in voltage sampling

Publisher:快乐航程Latest update time:2006-09-29 Source: 单片机与嵌入式系统ic网Keywords:sampling Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction
  In the power system, voltage and frequency are two important parameters that reflect the power quality of the power system. At the same time, in the relay protection industry, voltage and frequency are also important criteria for corresponding actions of relay protection, measurement and control, synchronized closing and other devices.   In power systems, generally in order to save frequency measurement loops, frequency measurement has traditionally used the sampling instantaneous value of voltage to calculate frequency [2] [3] . This method has limited sampling accuracy and harmonics, although various methods are used. Despite this compensation measure, the actual measurement accuracy still cannot meet the requirements of devices that use frequency or frequency difference as action criteria, such as automatic synchronization. Voltage calculations traditionally use the Fourier algorithm. The Fourier algorithm has the advantage of separating the fundamental wave and each harmonic component, and can obtain the size of each component, so it has been widely used. However, the correlation coefficient in this algorithm is fixed, and when the frequency of the measured signal changes, it will bring about larger measurement errors. For this situation, there is a method of using a phase-locked frequency multiplier sampling trigger circuit [4][5] to ensure that the same number of sampling points is obtained in each signal period and improve the calculation accuracy. However, at the same time, this specialized phase-locked multiplier The frequency sampling trigger circuit increases the design cost and debugging difficulty.   This article proposes a method to measure the frequency of signals using the HIS (High Speed ​​Input) of 80C196. The measurement accuracy is high. The voltage sampling frequency is changed accordingly based on the measured frequency to achieve frequency tracking and greatly improve the voltage calculation. Accuracy. This method not only simplifies the circuit design, but also improves the voltage calculation accuracy while obtaining high-precision frequency measurement. 2 Hardware design 2.1 Hardware composition  In the power system, the three-phase voltage frequencies are the same, and any one of the phases can be selected as the frequency measurement signal. The hardware structure is shown in Figure 1.  

  

  








  Frequency measurement signals require filtering and shaping circuits. Filtering is to filter out harmonics and ripples and provide better detection signals for shaping. The shaping circuit converts the filtered sinusoidal signal into a square wave signal. Voltage measurements do not require filtering in order to retain more waveform information.

2.2 Filtering and shaping circuit
  
  Because measuring frequency only requires periodic signals without phase information, the shaping circuit does not require zero-crossing detection. Taking this into account, the shaping circuit is more convenient to implement. In the actual design, in order to simplify the circuit, the filter circuit and shaping circuit functions are completed by an integrated chip MC1489. MC1489 is a monolithic integrated four-channel level converter, each of which can achieve shaping function, and an external capacitor plays a filtering role. The circuit is shown in Figure 2.

3 Software implementation

3.1 Frequency measurement principle and error analysis


  Using HSI events to implement frequency measurement is actually a method of measuring the cycle. For the 80C196 microcontroller, that is, within the triggering time, the signal cycle is counted every 8 crystal oscillator cycles. When the crystal oscillation frequency is 20 MHz, the internal crystal oscillator period is 0.1 μs (because the internal frequency division is divided by 2), and it counts every 0.8 μs. It can be seen from this that the absolute maximum error of measurement is 1.6 μs for the front and rear boundaries of the signal. For a 50 Hz signal with a period of 20 ms, the maximum error is converted to a frequency of about 0.004 Hz. Therefore, the frequency measurement accuracy can reach 0 .01 Hz. When the crystal oscillation frequency is higher or the period of the measured signal is longer, the relative error will be smaller.

3.2 Implementation idea of ​​frequency measurement
  
  HSI events can be read in interrupt mode and query mode. Because the sampling interrupt interval needs to be changed while measuring frequency, it is more convenient and concise to implement it in query mode during sampling interrupt.
  
  In query mode, HSI events are mainly realized by configuring or reading the contents of registers IOC0, HSI MODE, IOS1, HSI STATUS and HSI TIME. IOC0 is used for event pin selection. There are four trigger modes for external events input by the HSI pin, namely negative transition trigger, positive transition trigger, positive and negative transition trigger, and every 8 positive transition triggers. Each trigger mode is set through HSI MODE. IOS1 records the information about whether the register data saved by the HSI component is valid. HSI STATUS stores two types of information for each input pin. One is to indicate whether an event occurs on the pin, and the other is to record the current level status of the pin. HSI TIME stores the time value of the event stored in the holding register [1] .
  
  It is assumed that HSI only uses HSI. 0. During initialization, set IOC0 to 01H and select HSI. 0 is the event input pin. Set the HSI MODE register to 01H, that is, each positive transition becomes an event trigger mode. To read the time value in the sampling interrupt, first query IOS1.7. If this bit is 1, it means that the holding register has been loaded and the HSI event can be read. Read the HSI STATUS and HSI TIME registers and process them.

3.3 Frequency calculation and sampling tracking
  
  For the sake of clarity, the frequency measurement and frequency tracking program source code is given here. This program adds the function of preventing sampling errors caused by errors in the frequency measurement loop.




  Among them, t freq, tcy, tcy+2, ltcy, iosl map, freq err, freq are the defined general registers of 80C196, SH Point, Tcy Normal are the prescribed constants, which are the number of sampling points in a week and HSI normal count value at 50Hz. t freq is the frequency measurement count, which represents the actual count value of HIS within the trigger time. In applications, the count can be divided by different values ​​according to different measurement accuracy requirements to obtain the frequency value. For a 50 Hz signal, the count in one cycle is theoretically 25 000. Divide this value by 125 000000 (Constant freqhl) to get the fixed-point operation value freq of frequency measurement with a measurement accuracy of 0.01Hz (as above) shown in the program).

4. Tracking Capability Analysis
  From the above frequency tracking implementation process, when the signal frequency is stable at a certain frequency, HSI will generate a data valid event as long as one cycle of the signal passes, and the sampling frequency can track the signal frequency, thereby improving Voltage calculation accuracy.   For signals that change frequency with a certain slip, there is a real-time problem of sampling and tracking. It can be known from the experiment that when frequency tracking is not implemented, when the deviation of the signal frequency from the 50 Hz reference frequency is less than 0.5 Hz, the voltage calculation accuracy is still high and can meet the behavioral needs of each device. To increase computational redundancy, it can be limited to 0.3 Hz. Because the frequency tracking of this algorithm is that the signal is tracked once a week, for the power system, that is, it is tracked once every 20 ms. Therefore, as long as the slip is less than 0.3Hz/20ms=15Hz/s, the voltage sampling can track the signal frequency without affect calculation accuracy. In fact, the frequency slip of 15Hz/s does not exist at all in the power system. Therefore, this algorithm is feasible. 5. The impact of frequency tracking on voltage calculation and conclusion.  The author used an 80C196, 12-bit A/D microcontroller system to program a 12-point weekly sampling calculation simulation test for a 50 Hz, 100 V voltage signal. When the signal frequency When the deviation from 50 Hz is large, using the sampling frequency to track the signal frequency has higher accuracy than the voltage calculation without this method. By observing the real-time display data, the calculation and comparison diagram of the two when the frequency is 55 Hz is shown in Figure 3.  

  



  



  In addition, for signals whose frequency continuously changes with a certain slip, the voltage calculation still has high accuracy because the sampling frequency has a real-time tracking function.
  
  The frequency measurement method proposed in this article has simple software and hardware implementation and high measurement accuracy. The sampling frequency tracks the signal frequency, making the sampled values ​​better suited to the Fourier algorithm, thereby improving voltage calculation accuracy. It is suitable for high-precision frequency and voltage measurements in various relay protection devices in power systems.

 

references

1 Wang Jian, Sun Kaikai, Zhang Shuhan. MCS-96 series microcontroller principle and application technology. Wuhan: Huazhong University of Science and Technology Press, 1999
2 Suonanjiale, Ge Yaozhong, Wang Ding'an, et al. A new frequency measurement method that is not affected by voltage zero crossing. Journal of Electric Power Systems and Automation, 1996, 8(4): 19~21
3 Li Ruisheng. A method for calculating power system frequency based on digital sampling. Relay, 1997, 25(1): 26~28
4 Du Guangyu, Chen Xiaoqiao, Wan Zhongtian. Application of phase-locked frequency multiplication and quasi-synchronous sampling methods in harmonic measurement. Journal of Wuhan University (Engineering Edition), 2001, 34(5): 39~44
5 Chen Zhenhui, Cai Canyong, Yan Kai, et al. Phase-locked loop frequency multiplier software implementation and application in power harmonic parameter detection system. Electronic Measurement Technology, 2001(4)

Keywords:sampling Reference address:Frequency measurement based on 80C196 and its application in voltage sampling

Previous article:Frequency measurement based on 80C196 and its application in voltage sampling
Next article:Application of single chip microcomputer in micro printer

Recommended ReadingLatest update time:2024-11-16 18:08

Automated High Voltage Shock Testing Using NI LabVIEW
Author(s): David Hakey - Medtronic, Inc. Patrick J. Ryan - Medtronic, Inc. Johnny Maynes - Medtronic, Inc. Industry: Electronics, Biotechnology Products: NI-VISA, LabVIEW, FPGA Module, PXI-7811R The Challenge: Build an automated high voltage (HV) arrester test system to test 12
[Test Measurement]
Automated High Voltage Shock Testing Using NI LabVIEW
Design of a High Performance Bandgap Voltage Reference
The reference voltage is an important part of the integrated circuit design, especially in high-precision voltage comparators, data acquisition systems, and A/D and D/A converters. The changes in the reference voltage with temperature and power supply voltage fluctuations will directly affect the performance of th
[Power Management]
Design of a High Performance Bandgap Voltage Reference
Design of non-isolated negative voltage DC/DC switching power supply
With the rapid development of electronic technology, modern electronic measurement devices often require negative power supplies to power their internal integrated circuit chips and sensors , such as integrated operational amplifiers, voltage comparators, Hall sensors, etc. The quality o
[Power Management]
Design of non-isolated negative voltage DC/DC switching power supply
Breakthrough and mass production of a new high-voltage lithium manganate technology
With the rapid development of the new energy industry, lithium-ion batteries have increasingly higher requirements for the energy density of cathode materials . However, the gram capacity is close to the theoretical value and there is not much room for improvement. Therefore, expanding the working voltage range of cat
[Automotive Electronics]
Breakthrough and mass production of a new high-voltage lithium manganate technology
Toshiba Launches 1500V High Voltage Automotive Photorelay
— New device suitable for high-voltage automotive batteries — Shanghai, China, January 20, 2022 – Toshiba Electronic Devices & Storage Corporation (“Toshiba”) today announced the launch of the TLX9160T, a normally open (NO) 1-Form-A photorelay for high-voltage automotive batteries . This new d
[Power Management]
Toshiba Launches 1500V High Voltage Automotive Photorelay
New range of fireproof wirewound resistors from TT Electronics combines high surge withstand with line voltage protection fusing
New range of fireproof wirewound resistors from TT Electronics combines high surge withstand with line voltage protection fusing TT Electronics' WHS-UL surge resistors offer outstanding reliability, increased product safety and simplified UL certification for a wide range of power and monitoring appli
[Power Management]
Voltage stress of energy storage capacitor CB
For BIFRED and BIBRED converters, the energy storage capacitor CB is both the output filter capacitor of the PFC converter and the input voltage source of the load converter. When working at a constant frequency and light load, the load current decreases, the on-time tON and duty cycle Du of the switch tube decrease
[Power Management]
Voltage stress of energy storage capacitor CB
Working principle of multimeter DC current and voltage measurement circuit
1. Working principle of DC current measurement circuit The main component of the pointer type is a magnetoelectric ammeter, usually called a meter head. However, a meter head can only measure currents that are less than its sensitivity. In order to expand the range of the measured current, it is necessary to connect a
[Test Measurement]
Working principle of multimeter DC current and voltage measurement circuit
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号