Design of data forwarder based on MSP430F149
[Copy link]
Abstract: With MSP430F149 single-chip microcomputer as the core, a dual serial communication transponder for the automatic reading system of electric energy meters is designed, and the hardware structure framework and software design scheme of the transponder are given. The transponder realizes data communication between the host and the electric meter reader through three communication modes.Overview The current large number of manual meter reading methods are far from meeting the needs of modern management, and the resulting increase in line loss rates will inevitably affect the development of the power industry. One of the main reasons for the high line loss rate is the backwardness of meter reading, calculation and management methods, which increases management losses. If the automatic meter reading system is adopted, it can not only greatly improve the reliability of power grid operation, but also make full use of the capacity of existing equipment and reduce labor intensity. The system is mainly composed of three parts: meter reader (data acquisition), data forwarder (data transmission) and host (data processing). This article mainly designs the data forwarder part. Usually, electric meters use three communication methods: infrared communication, RS485 communication or wireless radio frequency communication, while ordinary electric meter readers generally only have one of the three communication interfaces mentioned above. In order to be applicable to these three common electric meter readers and to conveniently and effectively transmit the data of the meter reader to the host, the data forwarder integrates these three communication interfaces. The complete receiving system can realize data exchange between the host and the electric meter reader through the data forwarder. It is a multi-channel computer data transmission system, and the structural principle is shown in Figure 1. The last three channel modules communicate serially with the single-chip microcomputer MSP430 through a multiplexer, while the MSP430F149 communicates data with the host through the RS232 communication module.
1 Single-chip microcomputer interface design The MSP430F149 microcontroller used in this design belongs to the MSP430 series of Texas Instruments. The MSP430 series is a group of ultra-low power microcontrollers, consisting of a variety of models with different modules for different application targets. The microcontroller is designed to work for a long time using batteries, and the power supply voltage range is 1.8~3.6V. MSP430F149 has 60KB Flash and 2KB RAM. The Flash is divided into 120 main memory segments (512B each) and two information memory segments (128B each). Flash can be erased in its entirety or in segments, which brings great convenience and flexibility to the system's hardware and software design. In view of the capacity and characteristics of the microcontroller memory, there is no need to expand the external memory and I/O port, and the peripheral devices are simplified. The operating voltage of MSP430F149 is 3.3V, so its I/O level is also 3.3V logic level and is compatible with 5V TTL level. MSP430F149 has two serial asynchronous communication ports. The interface circuit schematic diagram between it and the host and the following three communication modules is shown in Figure 2. The communication mode selected by the meter reader is converted by the MSP430F149 microcontroller controlling the level of the A and B pins of the multiplexer CD4052. The data communication between MSP430F149 and the host is realized through the RS232 communication module. The RS232 module is mainly composed of MAXIM 's MAX232/MAX232A receiver/transmitter, which is specially designed by MAXIM to meet the EIA/TEA 232E standard. They are increasingly widely used in the EIA/TIA 232E standard serial communication interface, with low power consumption, single power supply, and external capacitance of only 0.1μF or 1μF; they adopt dual in-line package form, and the receiver output is three-state TTL COMS. It is a dual-group RS232 receiver/transmitter, with a working power supply of +5V, high baud rate, and low price. It can be used in general systems that require serial communication.
Figure 2
2 Communication circuit design 2.1 RS485 communication interface circuit The data transmission between the repeater and the meter reader passes through the RS485 transceiver MAX485, and is sent and received by the TXD and RXD of the microcontroller serial port. The microcontroller of the repeater has a specified address code, and the CPU constantly queries the RXD port data. When the address data is determined to be the corresponding address of the repeater, the operation data is read in, and then the control function is determined, and the corresponding control signal is issued. MAX485 is a differential balanced low-power transceiver chip. The chip contains a driver and a receiver, powered by a single +5V power supply, and is dedicated to the conversion between TTL protocol (i.e., the communication protocol commonly used in various CPUs) and 485 protocol. Its RS485 communication interface circuit is shown in Figure 3. The biggest advantage of RS485 is its multi-point bus interconnection function, which can connect one host and multiple terminals to communicate simultaneously. Because it is a half-duplex mode, only one party can send and the other party can receive, and it uses a differential level receiving method to improve anti-interference ability, which is suitable for working in relatively harsh environments. 2.2 Wireless RF Communication Interface Circuit The single-chip wireless serial interface circuit is composed of the MICRF102 single-chip transmitter chip and the MICRF007 single-chip receiver chip, and operates in the 300-440MHz ISM frequency band; it has ASK modulation and demodulation capabilities, strong anti-interference ability, and is suitable for industrial control applications; it adopts PLL frequency synthesis technology and has good frequency stability; it can be used for wireless transmission of serial data between single-chip microcomputers, and can also be used in single-chip microcomputer data acquisition, telemetry and remote control systems. (1) Wireless transmission circuit The wireless transmission circuit is based on MICRF102, as shown in Figure 4 (a). MICRF102 is a single-chip UHF ASK transmitter launched by Micrel, which uses SOP (M) -8 package. The chip contains: a synthesizer composed of a reference oscillator, a phase detector, a frequency divider, a bandpass filter, a voltage-controlled oscillator, a transmission bias control, an RF power amplifier, an antenna tuning control and a varactor diode, etc. It is a true "data input-wireless output" single-chip wireless transmission device. The UHF synthesizer generates carrier frequency and quadrature signal outputs. The input phase input (I) is used to drive the RF power amplifier. The antenna tuning quadrature signal (Q) is used to compare the antenna signal phase. The antenna tuning control section detects the phase of the transmit signal in the antenna channel and controls the capacitance of the varactor diode to tune the antenna and achieve automatic antenna tuning. The power amplifier output is controlled by the transmit bias control unit. ASK/OOK modulation provides a low power mode with a data transmission rate of 20kb/s. (2) Wireless receiving circuit The wireless receiving circuit is based on MICRF007, as shown in Figure 4 (b). MICRF007 is a single-chip UHF ASK/OOK (on-off keying) superheterodyne radio receiving chip launched by Micrel. MICRF007 uses SOP (M) -8 package, and the circuit inside the chip can be divided into three parts: UHF down-converter, OOK demodulator and reference control. The UHF down-converter includes RF amplifier, mixer, intermediate frequency amplifier, bandpass filter, peak detector, synthesizer, AGC control circuit; OOK demodulator includes low-pass filter, comparator; reference control circuit includes reference oscillator and control logic circuit. Only two external capacitors CAGC and CTH, a crystal oscillator and power supply decoupling capacitor are needed to form a UHF ASK receiver. All RF and IF tuning are automatically completed in the chip, which is a true "wireless input-data output" single-chip device. MICRF007 is a standard narrow RF bandwidth superheterodyne receiver, and the narrow bandwidth receiver is insensitive to RF interference signals. The RF center frequency is controlled by a fully integrated PLL/VCO frequency synthesizer and is related to the reference oscillator external crystal. The bandwidth of the IF bandpass filter is 430kHz, and the bandwidth of the low-pass filter of the baseband demodulator is 2.1kHz. The digital ASK signal is received, and the receiver data transmission rate is 2Kb/s.
2.3 Infrared communication interface circuit The infrared communication interface circuit is essentially a photoelectric signal conversion circuit composed of an infrared emitting tube and a transmission gate. The circuit design is related to the actual required transmission distance. This infrared communication module isolates the electrical connection of the two infrared devices, has good anti-interference ability, and can truly realize infrared transmission. Figure 5 (a) is an infrared transmitting circuit, which is mainly composed of one NOR gate, one infrared transmitting tube and one amplifier transistor. P1.1 of the MSP430F149 microcontroller generates a carrier signal, which modulates the TXD data through the NOR gate CD4071, and finally sends the data signal to the meter reader through the infrared transmitting tube and the amplifier transistor. Figure 5 (b) is an infrared receiving circuit. It is mainly composed of NJL41V328. The NJL41 series is a newly launched integrated infrared receiver by JRC (New Japan Corporation), which integrates infrared reception and amplification. It does not require any external components to complete all the work from infrared reception to output compatible with TTL level signals, and it is the same size as an ordinary plastic-encapsulated transistor. Therefore, it is suitable for various infrared remote controls and infrared data transmission, and is an ideal component to replace infrared receiving amplifiers such as receiving diodes. NJL41V328 is used for data exchange between the repeater and the electric meter reader, realizing wireless data communication between the repeater and the electric meter reader. FIG5 is a schematic diagram of the infrared communication interface circuit.
3 Serial Communication Programming Data transmission is carried out between the PC host and the meter reader. The PC communication program is implemented through the MSComm control of VB (Visual Basic, Visual Basic programming language). The MSP430F149 microcontroller uses a 32768Hz oscillation frequency, a baud rate of 4800b/s, and a half-duplex serial communication mode. The microcontroller serial communication program must be programmed in assembly language, and the program flow is shown in Figure 6.
Conclusion This design adopts the MSP430F149 single-chip microcomputer, whose rich on-chip peripheral function modules greatly simplify the peripheral circuits; its ultra-low power consumption mode reduces costs and improves operational reliability. Currently, this design has achieved good results in the actual operation of the automatic reading system of the electric energy meter.
|