Design of intelligent node of distributed control

  • Detail

Design of intelligent node of distributed control system based on CAN bus

preface fieldbus is one of the hot spots in the field of automation technology development, and is known as the computer local area in the field of automation. Its appearance provides strong technical support for the distributed control system to realize real-time and reliable data communication between nodes. Can (controller area network) belongs to the field bus. It is a serial communication network that effectively supports distributed control or real-time control. Compared with many RS-485 distributed control systems based on R-line at present, the distributed control system based on CAN bus has obvious advantages in the following aspects: strictly follow the cycle and inspection and maintenance items specified in the operation manual. First, the CAN controller works in the multi master mode, Each node in the network can compete to send data to the bus in the way of bit by bit arbitration of lossless structure according to the bus access priority (depending on the message identifier), and the CAN protocol abolishes the station address coding, and instead encodes the communication data, which enables different nodes to receive the same data at the same time. These characteristics make the data communication between nodes in the network composed of CAN bus more real-time, And it is easy to form a redundant structure to improve the reliability and flexibility of the system. RS-485 can only form a master-slave structure system, and the communication mode can only be carried out in the way of master station polling, so the real-time performance and reliability of the system are poor; Secondly, the CAN bus is connected to the physical bus through the two output terminals canh and canl of the CAN controller interface chip 82C250, and the state of the canh end can only be high-level or suspended state, and the canl end can only be low-level or suspended state. 4. Experimental steps: floating state. This ensures that there will be no such phenomenon as in RS-485 network. When the system has errors and multiple nodes send data to the bus at the same time, the bus will be short circuited and some nodes will be damaged. Moreover, the CAN node has the function of automatically closing the output in case of serious errors, so that the operation of other nodes on the bus will not be affected, so as to ensure that there will be no image in the network. Due to the problems of individual nodes, the bus is in a "deadlock" state. Moreover, the perfect communication protocol of can can can be realized by CAN controller chip and its interface chip, which greatly reduces the difficulty of system development and shortens the development cycle, which is unmatched by RS-485 with only electrical protocol. In addition, compared with other fieldbus, can bus has many characteristics, such as high communication rate, easy implementation, and high cost performance. It has formed an international standard fieldbus. These are also the important reasons why can bus is applied in many fields and has strong market competitiveness. The hardware circuit design can follows the standard model of ISO, which is divided into data link layer and physical layer. In engineering, these two layers are usually realized by CAN controller and transceiver. At present, there are two kinds of CAN bus devices available on the market: one is a microcontroller with on-chip can, such as p8xc591/2, 87c196ca/cb, MC68376, powerpc555, etc. using this kind of integrated device is convenient for users to make printed boards, and the circuit diagram is more compact; The other is an independent can controller, such as Philips SJA1000, Intel 82526 and mcp2510 (with SPI interface, convenient MCU connection), etc. the potential advantage of using an independent can controller is that system developers can choose the most ideal system design scheme from many kinds of MCU according to their needs. The hardware circuit diagram of intelligent node designed by the author is sketchy (see "electronic products world" 2002.10 for details). The node microcontroller is 80C196KC, and the can interface is composed of independent controller SJA1000 and can controller interface chip 82C250. SJA1000 is compatible with its previous pca82c200 independent controller in software and pin, and has added many new functions: standard frame data structure and extended frame data structure, and both of these frames have single/double receiving filters; 64 byte receive FIFO; Read/write access error counters, error limit alarms, listen only mode, etc

sja1000 has two working modes: basic can mode and Pelican mode. Pelican mode fully supports CAN2.0B protocol. SJA1000 is an off chip expansion chip of the microcontroller, and its chip selection pin CS is connected to the address decoder of the microcontroller, which determines the address of each register of the CAN controller. SJA1000 is connected to the physical bus through CAN controller interface chip 82C250. 82C250 device provides differential sending ability to bus and differential receiving ability to can controller, which is fully compatible with the "iso11898" standard. Its pin 8 allows three different working modes to be selected: high speed, slope control and standby. In low speed and short bus length, slope control mode is generally adopted to limit the rising and falling slopes and reduce RF interference. The slope can be controlled through the resistance connected from pin 8 to the ground. The slope is proportional to the current output on pin 8. In order to further improve the anti-interference ability of the system, a 6n137 photoelectric isolation chip is added between the CAN controller SJA1000 and the CAN controller interface 82C250, and a DC-DC converter is used to isolate the power supply. When the communication signal is transmitted to the end of the wire, reflection will occur, and the reflected signal will interfere with the transmission of the normal signal. Therefore, terminal resistors R1 and R2 are connected at both ends of the bus to eliminate the reflected signal, and their resistance value is about equal to the characteristic impedance of the transmission cable. Software design can bus node to effectively and timely complete the communication task, software design is the key, but also difficult. It mainly includes node initialization program, message sending program, message receiving program, can bus error handling program and so on. The internal register of CAN controller chip SJA1000 exists and functions as an off chip register of microcontroller. The exchange of state, control and command between the microcontroller and SJA1000 is completed by reading and writing these registers in reset mode or working mode. When initializing the can internal register, pay attention to making the waste plastic particles 1 in short supply. The bit rate of each node must be consistent, and the receiving and sending sides must be synchronized. There are two main ways to receive messages: interrupt and query. In order to improve the real-time performance of communication, this paper adopts the interrupt receiving method, which can also ensure that the receiving buffer will not overflow data. The basic can working mode of SJA1000 is the same as the previous pca82c20

Copyright © 2011 JIN SHI