4143 views|0 replies

1379

Posts

0

Resources
The OP
 

Application skills/Three-phase energy meter SA9904B acquisition system based on MSP430 [Copy link]

Abstract : This paper introduces a system for collecting parameters such as the useless power and useful power of a three-phase electric energy meter, which is composed of TI's MSP430F435 microcontroller and SAMES's SA9904B electric energy measurement integrated chip.
Keywords : MSP430 SA9904B sampling
1. Introduction
At present, the new electronic multifunctional energy meter has gradually replaced the old electronic energy meter. Due to the sampling accuracy of analog-to-digital conversion circuit, the price of microprocessor, and the difficulty of software development, there are many problems and difficulties. Based on the MSP430F435 microcontroller of Texas Instruments, this paper introduces the use of SAMES SA9904B highly integrated sampling chip to collect useful work and useless work parameters of three-phase electric energy, replacing the traditional digital-to-analog sampling circuit.
The sampling of power parameters of three-phase electric energy meters is a very important issue. Its implementation method determines the measurement accuracy of the electric energy meter, the difficulty of corresponding software development, and the overall development cost of the product.
2. System Introduction
There are many solutions for the sampling method of electric energy meters and what MCU to use, and many of them have been put into practical use. However, electric energy meters based on MSP430 microcontrollers using highly integrated acquisition chips SA9904B for current and voltage sampling have not been widely put into production. Although TI of the United States has provided an electric energy meter sampling solution, its sampling circuit is relatively complex and difficult to debug. There is no dedicated chip for electric energy meters.
Figure 1 is the sampling part of the multifunctional three-phase energy meter, which rationally combines TI's MSP430 microcontroller and SAMES's SA9904B, giving full play to their respective advantages, avoiding the design of complex sampling circuits, and using ready-made high-precision sampling chips.
2.1 . Hardware:
MSP430F435
T1's MSP430 series microcontroller is a powerful microcontroller with ultra-low power consumption. The newly developed F series has Flash memory, which has obvious advantages over other MCUs in system design, development and debugging, and practical application.
1. Ultra-low power consumption
When the MSP430F series runs at 1MHZ clock, the operating mode is 0.1~400uA and the operating voltage is 1.8~3.6V.
2. Super processing capability
8MIPS CPU core, 16-bit x 16-bit hardware multiplier.
3. Flexible configuration method
The MSP430 F series has a rich addressing mode, requiring only 27 instructions; a large number of on-chip registers that can implement a variety of operations; and an efficient table lookup processing method. All of this ensures that efficient programs can be compiled. There are many interrupts that can be nested and are easy to use.
4. On-chip integrated peripheral function modules
The MSP430 F series integrates a large number of on-chip peripherals. These peripherals are quite powerful: 12-bit A/D, precision analog comparator, hardware multiplier, 2 groups of clock modules with a frequency of up to 8MHZ, 2 16-bit timers with many capture comparisons, watchdog function, 2 serial communication interfaces that can realize asynchronous and synchronous and multiple access, dozens of parallel input and output ports that can realize direction setting and interrupt function, and SPI and UASRT communication ports.
5. Efficient development method
The MSP430FX series has FLASH memory, which makes its development tools quite simple. The program code can be loaded into the Flash memory through the serial or parallel port by using the JTAG interface of the microcontroller itself or the default loader Bootstrap fixed in the on-chip BOOT ROM.
The program can be downloaded with the help of a PC and a small JATAG controller, and online program debugging can be completed conveniently.
SA9904B
SAMES' SA9904B is an integrated chip dedicated to electric energy measurement, providing multifunctional power measurement parameters: power factor, active power, reactive power, peak voltage, peak power, voltage and current effective value, etc.
The current and voltage of each channel of the SA9904B three-phase circuit are sampled, and the useful power and useless power are obtained by multiplying the three-channel current and the three-channel voltage of the SA9904B. The digital-to-analog conversion and phase delay adjustment are completed inside the chip. The digital value of each channel of instantaneous power is stored in a 24-bit register, and the maximum value is hexadecimal FFFF, corresponding to the DO port of the chip. The reading of each channel of the register is determined by the value of each channel address memory, corresponding to the DI port of the chip. These are all communicated with the MCU port in serial data mode through the chip's SPI interface. The MCU completes the data reading of the chip by selecting the address.
The SPI interface of SA9904B is divided into DI, DO, SCK, CS, and F50 ports, where these ports transmit data with the MCU according to the timing of Figure 2. During the research and development process, some filtering circuits should be added to the DI and DO ports to prevent spike levels in the line. This can be adjusted according to actual needs. The output pulse width time of each port is shown in Table 1. The data on DI and DO is only valid when CS and SCK are high levels. The DI trigger is triggered at the same time as the CS trigger, and the data on DI is completed within the high level of SCK. The data on DO must be triggered when the SCK is high and completed within the next high level stage. F50 is the frequency register
The frequency of the voltage is stored and whether there is a phase loss or phase inversion. The data on DI is consistent with the address of the data register on SA9904B, that is, the upper three bits are 110, the fourth and fifth bits are either 0 or 1, and the last four bits are the selection code. For the time delay of each port, see Table 1.
2.2 Software
For MSP430 microcontroller, TI's own embedded software development platform IAR EMBEDDED WORKBENCH can be used. This software can debug the development system online, has a C compiler, and can be programmed in the general C language.
1. Software Flowchart
The SA9904B chip is synchronized with data through the P6.6-P6.3 port of the MSP430, where the P6.3 port is used for DI, P6.4 for SCK, P6.5 for CS, P6.6 for DO, and P1.0 for F50.
The program flow is shown in Figure 3.
1. Analysis of the main control program
The control acquisition system involves the SPI serial synchronous communication interface of the microcontroller and the timer TIME_A.
Among them, DI, DO, and F50 ports are SPI ports for serial data communication, receiving data in the SA9904B register. SCK and CS send square wave pulses to SA9904B through timer TIME_A to trigger SA9904B to work.
First, SCK, CS signal control port
The P6.4 of the MSP430 MCU sends a square wave, and the P6.5 is set to a high level, so that the register address data on the DI port can be valid, and the data values of the active power register and the reactive power register in the SA9904B can be output. These two ports are selected as the I/O function of the MCU.
Second, DI port data transmission
Select SPI, four-wire communication, MSP430's P6.6-P6.3 port, send 16-bit address data stream, use SCK as the time source, and actively send data to SA9904B.
P6SEL = cs +sck +si_1; //Select SCK, CS as I/O function, SI as module function.
P6DIR = cs_1 +sck_1 +si_1; // Select SCK, CS set high, SI as external output.
my_flag1= tempadd0<<7; // Left shift 7 bits
my_flag2= my_flag2&0x8000; // Take the highest bit and input data to SA9904B.
if(my_flag2==0x8000)
{
P6OUT = cs_1+sck_1 +si_1;
my_flag1= my_flag1<<1;
P6OUT = cs_1 +0 +si_1;} //Input 1, SCK set to 0
else
{P6OUT = cs +sck +si_1;
my_flag1= my_flag1<<1;
P6OUT = cs +0 +si;} //Input 0, SCK set to 0
my_flag2= my_flag1;
}
Some of these parameters are defined quantities.
This output process is repeated 9 times, that is, the 9-bit data is input into the SA9904B address register from high to low.
Third, DO port data transmission
Similar to the DI port data transmission, the main consideration is to display the data in the active and reactive data registers on the P6.6 port. The 24-bit data is read out in the order of transmission from high to low.
for (i=4;i>1;i--)
{for (j=7;j>=0;j--)
{
P6SEL = cs +sck + so_1; //Select SCK, CS as I/O function, SO as module function.
P6DIR = cs_1 +sck_1 + so; // Select SCK, CS as outward, SO as internal output.
P6OUT = cs_1 +sck_1 + 0; // Select SCK, CS set high.
my_flag=(unsigned char)(P6IN);//Read the value in the P6IN register.
P6OUT = cs_1 +sck + 0;
aa=(aa|(my_flag<<j)); //Store data.
my_flag=0x00;
}
if (i>2){aa=aa<<8;} } //Shift left 8 bits.
return aa;
}
The definitions of parameters such as cs, sck, and so are as shown in the form of cs:P6SEL |= 0x20.
Fourth, F50 register data processing
The processing method of this port is the same as that of DO and SI mentioned above, but the data information of F50 is richer, including the frequency of the voltage, whether there is a phase sequence error, whether there is a phase loss, and the counting of the voltage frequency is at the rising edge of the voltage. The register records one and accumulates it.
The above briefly introduces the programming process for the SPI communication method of the microcontroller. It can be seen that the operation of SA9904B mainly focuses on the input and output of data, and controls the data transmission timing. The order of data transmission from high to low must be read or input one by one. After collecting these data, they must be processed accordingly. In view of the port particularity of the 430 microcontroller, first select the function, then select the transmission direction, and finally determine the data reading or input.
2. Conclusion
At present, there are some solutions for measuring electric energy using a combination of electric energy integrated chips and single-chip microcomputers, but most of them are based on data collection through digital-to-analog conversion circuits. There are many kinds of integrated chips for measuring electric energy, and there are also many kinds of microprocessors. This article designs a cost-effective three-phase multi-rate multi-function meter based on the combination of TI's MSP430 single-chip microcomputer and SA9904B. The system module is limited to the collection of power parameters such as useful power and useless power, which is a very important part of the meter. The three-phase multi-rate multi-function meter for measuring electric energy also involves many other functional modules, including modules such as data processing, data display, data storage, and data communication.
This post is from Microcontroller MCU
 

Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list