introduction
DeviceNet, as an industry standard open network based on fieldbus technology, provides a connection between simple low-level industrial devices and high-level devices such as computers and PLCs. DeviceNet uses the international standard Control Area Network (CAN) protocol, has open technical specifications and inexpensive communication components, making it have a much lower development cost than other fieldbuses. The equipment network adopts bus power supply, provides intrinsically safe technology, and is widely used in various high-reliability applications.
This paper mainly studies the software and hardware design of the servo system based on DeviceNet. Data transmission and control through CAN bus, single-chip microcomputer and high-performance motor controller ADMC401 make the performance of servo motor more stable and can be applied to CNC system better and more flexibly.
Implementation of CAN bus and DeviceNet protocol
CAN bus protocol and characteristics
The controller area network CAN is a serial communication protocol, which can effectively support distributed real-time control with a high security level. CAN has a wide range of applications, from high-speed networks to low-cost multi-channel wiring can use CAN. In the automotive electronics industry, CAN is used to connect engine control units, sensors, anti-skid systems, etc., and its transmission speed can reach 1Mbps. At the same time, CAN can be installed in the electronic control system of the truck body, such as car lights, electric windows, etc., to replace the wiring and wiring device. Due to the use of many new technologies and unique design, compared with the general communication bus, CAN bus has outstanding reliability, real-time and flexibility in data communication. Its characteristics are summarized as follows [1]:
l CAN works in multi-master mode, any node on the network can actively send information to other nodes on the network at any time, without dividing the master and slave;
l On the message identifier, the nodes on CAN are divided into different priorities, which can meet different real-time requirements, and the data with high priority can be transmitted within 134us as soon as possible;
l CAN uses non-destructive bus arbitration technology. When multiple nodes send messages to the bus at the same time and there is a conflict, the lower priority node actively quits sending, and the highest priority node can continue to transmit data without being affected, thereby greatly saving the bus conflict arbitration time. Especially in the case of heavy network load, there will be no network paralysis (Ethernet may be possible).
DeviceNet protocol and characteristics
DeviceNet was developed by Allen Bredly of the United States in 1994. It is a field bus based on CAN, which realizes the network interconnection of low-cost and high-performance industrial equipment. The DeviceNet protocol is specifically customized for factory automation, and it plays a very important role in the United States and Asia. In Europe, more and more system solutions are implemented using DeviceNet.
The DeviceNet specification was approved by the National Standardization Management Committee as China's national standard in December 2002 and was implemented in April 2003. The DeviceNet protocol is suitable for the lowest-level fieldbus, such as: process sensors, actuators, valve blocks, motor starters, bar code readers, variable frequency drives, panel displays, operator interfaces and other control unit networks. Devices that can be connected via DeviceNet include various semiconductor products ranging from simple light barriers to complex vacuum pumps. DeviceNet is also a serial communication link that can reduce expensive hard wiring. The direct interconnectivity provided by DeviceNet not only improves the communication between devices, but also provides a very important device-level diagnostic function, which is difficult to achieve through hard-wired I / O interfaces. DeviceNet has many characteristics [2]:
l DeviceNet is based on CAN technology for the communication network between PLC and field devices. It can be connected to switches, frequency conversion speed regulation equipment, solid-state overload protection devices, bar code readers, I / O and man-machine interfaces, etc., and the transmission rate is 125 ~ 500kbps;
l The communication modes used by DeviceNet are: message producer (producer) and message consumer (consumer). The traditional communication adopts the technical method of specifying the data source and destination address in message transmission. The model used by DeviceNet is more effective, it can make the control data reach each unit of control at the same time, and can more effectively use the bandwidth of the network. The data sent by the message producer can be used by multiple message consumers at a time, thereby more effectively transmitting data;
l The communication protocol used by DeviceNet is an 11-bit identifier, that is, all I / O messages have their own 11-bit identifier ID, and the identifier ID is divided into four message groups, each of which has multiple uses and provides multiple priorities. . When working, the device on the bus listens to the message on the network, and when the device recognizes the correct identifier, it will accept the message;
l Each device on DeviceNet can be connected or disconnected at any time without affecting the normal operation of other devices. The true openness makes system expansion and modification very convenient.
Control system configuration
In order to realize the fast real-time control of the servo system, the system adopts single-chip + DSP dual CPU structure in the design. In the design, the system control tasks are divided: DSP completes the servo control tasks with high real-time requirements, the 8-bit microcontroller 89C51 of the FLASH structure completes the management tasks with low real-time requirements, and the communication between the microcontroller and the DSP uses parallel data mode , Realized by FPGA. At the same time, FPGA must also complete functions such as external I / O signal management, position pulse command signal processing and counting, and fault signal processing. The structure of the servo control system is shown in Figure 1. As can be seen from Figure 1, the system mainly has the following parts: servo control center ADMC401; peripheral interface FPGA + single chip 89C51; main circuit and switching power supply circuit [3]. Each is explained below.
DeviceNet communication interface
The DeviceNet interface circuit designed in this paper uses AT89C51ED2 as the node's microprocessor. In the CAN bus communication interface, the CAN communication controller uses SJA1000, and the CAN bus driver uses 82C250.
Figure 2 is a schematic diagram of the DeviceNet interface circuit. As can be seen from Figure 2, the circuit is mainly composed of 4 parts: microcontroller 89C51, independent CAN communication controller SJA1000, CAN bus transceiver 82C250 and high-speed photocoupler 6N137. The microprocessor 89C51 is responsible for the initialization of SJA1000, and realizes communication tasks such as data reception and transmission by controlling SJA1000.
In order to enhance the anti-interference ability of CAN bus nodes, TX0 and RXO of SJA1000 are not directly connected to TXD and RXD of 82C250, but are connected to 82C250 through high-speed optocoupler 6N137, so that each CAN node on the bus is well realized The electrical isolation between them protects the system circuit and the signal transmission of the bus. From the overall performance, the system design has good versatility and practicality.
The microcontroller AT89C51ED2 is used to implement the application layer protocol for communication. It has abundant memory resources, 4 8-bit I / O ports, 3 16-bit timers / counters, 256 bytes of temporary RAM, 9 interrupt sources, 4 priority levels, and 2K EEPROM space, the system does not External program memory needs to be expanded to meet the capacity requirements of DeviceNet protocol programs. And can work in & TImes; 2 mode (6 clocks / machine cycle), the design in this article is in & TImes; 2 mode. The single chip microcomputer realizes the communication with the upper computer by accessing the register of SJA1000. The receiving register and sending register of the CAN controller SJA1000 are used to temporarily store the received and sent data. The single-chip computer sends data by setting the command register of the SJA1000 to send command bits. The received data is realized by interruption. The INT pin of SJA1000 is connected to the INT1 pin of AT89C51ED2, so that the single-chip can respond to CAN interrupt requests in real time. The sampling period of 2ms is generated by the timer interrupt of AT89C51ED2.
Guangzhou Ehang Electronic Co., Ltd. , https://www.ehangmobile.com