Electricity centralized meter reading system based on CAN bus

Publisher:NexusDreamLatest update time:2012-11-30 Source: 维库开发网 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
0 Introduction

With the rapid development of computer technology and communication technology, it has become a reality to collect, transmit and process data from numerous metering points. The Automatic Meter Reading (AMR) technology came into being and gradually became the mainstream of meter reading technology.

1 Composition of the centralized power meter reading system

The electric power centralized meter reading system adopts a three-layer architecture, as shown in Figure 1. The first layer is the main station server, which is mainly responsible for storing the data of the multi-function meter and realizing the functions of remote monitoring and remote control of the meter. The server is installed in the meter reading main station of the customer service center, and receives the relevant data and parameters of each multi-function meter through GPRS/GSM. The second layer is the concentrator, which is connected to the main station server through GPRS/GSM and connected to the collection terminal of the third layer through the CAN bus to complete the data communication with the collector and the main station server. The third layer is the collector. Various standard communication protocols are embedded in the collector to realize the collection of various meters. The collector can collect and store data from 64 meters at the same time. It not only completes the electricity data collection of the meter, but also completes the data communication with the concentrator according to the requirements of the system, and sends the electricity data to be transmitted to the concentrator. Through GPRS/GSM wireless communication, the system can transmit remote information in a timely and convenient manner and exchange information with the main station server; each concentrator can manage up to 110 collectors through the CAN bus.


2 CAN bus communication system design

2.1 Introduction to CAN Bus

Controller Area Network (CAN) is one of the most widely used fieldbuses in the world. It has the advantages of advanced technology, high reliability, complete functions and reasonable cost, and has been widely used in various automation control systems. This design gives a CAN bus node solution and uses the built-in multi-channel CAN bus controller LPC2294 as the main controller.

2.2 CAN node hardware circuit composition

Figure 2 shows the CAN node hardware circuit, which consists of the AMR microcontroller LPC2294, CAN bus transceiver TJA1050T, high-speed optocoupler 6N137 and power isolation module B0505S.


2.2.1 Controller Features

The LPC2294 selected in this design is a powerful, ultra-low power 32-bit microcontroller with ARM7TDMI core newly launched by Philips. It has a 144-pin package, 2 32-bit timers, 8 10-bit ADCs, 4 CAN channels and PWM channels, and up to 9 external interrupts. It has an internal embedded 256 KB high-speed FLASH memory and 16 KB static RAM, and contains 76 (using external memory) to 112 (single chip) GPIO ports. Such rich on-chip resources can fully meet the needs of general industrial control, while also reducing the complexity of system hardware design. In addition, LPC2294 supports JTAG real-time simulation and tracking, a 128-bit wide memory interface and a unique acceleration structure, which can enable 32-bit code to run at an operating frequency of up to 60 MHz. LPC2294 has 4 CAN controllers integrated inside; it complies with CAN specification CAN2.0B and ISO 11989-1 standard; the bus data baud rate can reach 1 Mb/s; it can access 32-bit registers and RAM; the global acceptance filter can identify the 11-bit and 29-bit Rx identifiers of almost all buses; the acceptance filter provides FullCAN-style automatic reception function for selecting standard identifiers. As the core component of this design, LPC2294 not only plays the role of the main controller, but also serves as the node controller of the CAN network to realize data transmission and exchange with other nodes in the network. [page]

2.2.2 Transceiver Features

The transceiver TJA1050T is the interface between the CAN protocol controller and the physical bus and is fully compatible with the "ISO 11898" standard. CANH and CANL work together ideally to reduce electromagnetic radiation to a minimum. In addition, when the TJA1050T is not powered, the bus is passive, which makes the TJA1050T much better than previous CAN bus transceivers in terms of performance. The TJA1050T has two operating modes: high speed and silent (they are controlled by pin "S"). In high speed mode, the bus output signal has a fixed slope and switches as fast as possible. High speed mode is suitable for maximum bit speed and maximum bus length, and its transceiver cycle delay is minimal at this time; in silent mode, the transmitter is disabled regardless of the input signal of TxD. Silent mode prevents network communication from being blocked when the CAN controller is uncontrolled.

3 CAN bus communication system software design

For the LPC2294 microprocessor, the CAN controller is completely event-triggered, that is, when its own state changes, the CAN controller will tell the microprocessor the result of the state change. Therefore, the central microprocessor can use interrupt mode or polling mode to make corresponding processing on the CAN controller. Each CAN node sends data to the bus in the specified format and cycle, and takes the required message as needed. For receiving data, it is implemented in an interrupt mode. Once an interrupt occurs, the received data is loaded into the corresponding message register. At this time, the mask filter register is used to selectively compare the identifier of the received message with the identifier set in advance when the receive buffer is initialized. Only messages with matching identifiers can enter the receive buffer, and those messages that do not meet the requirements will be shielded outside the receive buffer, thereby reducing the burden of CPU processing messages.

3.1 CAN controller initialization

The operations of initializing the CAN controller include hardware enable, software reset, setting alarm limits, setting bus baud rate, setting interrupt working mode, setting acceptance filter working mode, setting working mode and starting CAN, etc. The initialization procedure is as follows:



3.2 Data transmission

After the data to be sent is packaged into a frame format that conforms to the CAN protocol, it can be written into the send buffer and the transmission can be started. Before writing the send buffer, its status must be queried. Each CAN controller in the LPC2294 has 3 send buffers, and their status can be obtained by querying CANSR. Data can only be written when there is an idle send buffer. This step is particularly important when sending a large amount of data, otherwise the reliability of the transmission cannot be guaranteed. After the transmission is successfully started, the data can only be judged whether it has been sent successfully by querying the TCS bit of CANGSR or cooperating with the successful transmission interrupt.

3.3 Data Reception

Data can be received in query mode or interrupt mode. The CAN bus is not always active during a period of time. To improve efficiency, the interrupt mode can be used. The receive interrupt must be enabled in the initialization program. In the interrupt service subroutine, read CANICR to determine whether there is a receive interrupt flag. If so, read the receive buffer data. In order to prevent the receive buffer data from overflowing, a circular receive data queue can be opened to temporarily store data, and the main program obtains bus data by querying the queue.

4 Conclusion

Based on the ARM CAN bus, the data communication of the centralized electric power meter reading system has strong real-time, reliability and anti-interference performance. The prototype of the system is undergoing network testing in order to further improve the communication processing, error correction and fault tolerance capabilities of the program through research and improvement.

References:

[1]. GPRS datasheet http://www.dzsc.com/datasheet/GPRS_1594650.html.
[2]. LPC2294 datasheet http://www.dzsc.com/datasheet/LPC2294_454558.html.
[3]. TJA1050T datasheet http://www.dzsc.com/datasheet/TJA1050T_649183.html.
[4]. 6N137 datasheet http://www.dzsc.com/datasheet/6N137_91364.html.
[5]. ARM7TDMI datasheet http://www. dzsc.com/datasheet/ARM7TDMI_139812.html.

Reference address:Electricity centralized meter reading system based on CAN bus

Previous article:Research and implementation of dynamic password terminal based on ARM7 smart card
Next article:Software Implementation of FIR Digital Filter Based on ARM

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号