Share this

Design of Intelligent Nodes for Distributed Control Systems Based on CAN Bus

2026-04-06 07:40:04 · · #1
Abstract: This paper introduces the design method of a distributed control system based on CAN bus, and presents the hardware circuit and software program of a CAN bus intelligent node composed of an Intel 87C196KD microprocessor and a PHILIP SJA1000 CAN controller. Keywords: CAN bus, distributed control system, SJA1000 Introduction Fieldbus is a hot topic in the field of automation technology today, and is known as the computer local area network of the automation field. Its emergence marks the beginning of a new era in the field of industrial control technology and has had a significant impact on the development of this field. Controller Area Network (CAN) belongs to the category of fieldbus. CAN bus data communication has extremely high reliability, real-time performance, and flexibility, and is an effective multi-master serial bus that supports distributed control systems and real-time control. 1. Distributed Control System Based on CAN Bus Figure 1 Distributed Control System Based on CAN Bus As shown in Figure 1, the distributed control system based on CAN bus adopts the fieldbus control system FCS (Fieldbus Control System) structure, which consists of a host computer, a CAN bus control network, and CAN intelligent nodes. The host computer primarily performs online system monitoring, connecting to the CAN bus via a CAN adapter card. CAN intelligent nodes handle data acquisition and calculation, node settings, node control, and operation display. The host computer and intelligent nodes exchange various data and management control information via the CAN fieldbus. 2. CAN Performance Characteristics: CAN operates in a multi-master mode, allowing any node on the network to actively send information to other nodes at any time, without master-slave distinctions. Communication is flexible and requires no station address or other node information. Node information on the CAN network is divided into different priorities to meet various real-time requirements; high-priority data can be transmitted within a maximum of 134μs. CAN employs non-destructive bus arbitration technology. When multiple nodes simultaneously send information to the bus, lower-priority nodes will actively withdraw from transmission, while higher-priority nodes can continue transmitting data unaffected, significantly reducing bus conflict arbitration time. CAN only requires message filtering to achieve point-to-point, point-to-multipoint, and global broadcast data transmission and reception, eliminating the need for dedicated "scheduling." CAN's direct communication distance can reach up to 10km (at speeds below 5kbps); the maximum communication speed can reach 1Mbps (at which point the maximum communication distance is 40m). The number of nodes on a CAN bus depends primarily on the bus driver circuit, currently up to 110, with up to 2032 message identifiers (CAN 2.0A), while the extended standard (CAN 2.0B) has virtually unlimited message identifiers. CAN uses a short frame structure, resulting in short transmission time, low probability of interference, and excellent error detection. Each CAN frame has CRC checksums and other error detection measures, ensuring an extremely low data error rate. CAN communication media can be twisted-pair cable, coaxial cable, or fiber optic cable, offering flexible selection. CAN nodes have an automatic output shutdown function in case of severe errors, ensuring that the operation of other nodes on the bus is not affected. 3. CAN Smart Node Hardware Design Currently, commonly used CAN devices fall into two main categories: independent CAN controllers, such as Philips' PCA82C250 and SJA1000, and microcontrollers with CAN functionality, such as PIC's DSPIC6014, TI's TMS320F2812, and Motorola's MC9S12DT128. This paper uses Intel's 87C196KD microprocessor and PHILIP's SJA1000 CAN controller to design a CAN bus smart node. [align=center] Figure 2 CAN Smart Node Hardware Circuit[/align] The CAN smart node hardware circuit is shown in Figure 2. The circuit mainly consists of five parts: an 87C196KD microcontroller, an independent CAN controller SJA1000, a CAN bus transceiver 82C250, a high-speed optocoupler 6N137, and a reset circuit. The 87C196KD microcontroller is the core component of the CAN intelligent node. It features 32KB of ROM and 1000KB of RAM and can be programmed using high-level languages. The 87C196KD primarily handles node data acquisition and calculation, node configuration, node control, and operation display, and also transmits and receives data with the SJA1000 CAN controller. The SJA1000 chip is a widely used and high-performance CAN bus controller. It handles the physical layer and data link layer functions of the CAN bus communication protocol. It has two operating modes: Basicmode and Pelimode. Compared to Basicmode, Pelimode supports extended frames, allowing message identifiers to reach 29 bits, providing more powerful functionality. To reduce the number of non-data characters per frame and improve information exchange speed, Basicmode is preferable in practical applications. In Basicmode, the SJA1000 functions as a memory-mapped peripheral device to the microprocessor, and its addressable domain consists of a control segment and receive/transmit buffers. The SJA1000's AD0-AD7 pins are connected to the 87C196KD's P3 port (data bus) using a parallel connection, resulting in fast data read/write speeds. The 87C196KD's address bus pins P4.6 and P4.7 are connected to the SJA1000's chip select signal CS via a decoder. The SJA1000's RD, WR, and ALE pins are connected to the 87C196KD's RD, WR, and ALE pins, respectively. The SJA1000's INT pin is connected to the 87C196KD's EXINT pin via a NOT gate. The microcontroller can also access the CAN controller via interrupts. The 82C250 serves as the interface between the CAN controller and the physical bus. The 82C250's CANL and CANH pins are connected to the CAN bus. If the 82C250 is at the network terminal of the CAN bus, a matching resistor needs to be added between CANL and CANH to eliminate interference from reflected signals. RS is used to select three different operating modes: high speed, slope control, and standby. RS is connected in series with a resistor and then grounded to control the rising and falling slopes, reducing radio frequency interference. To further improve the system's anti-interference capability, a high-speed optocoupler 6N137 is added between the CAN controller SJA1000 and the CAN bus transceiver 82C250, and a DC-DC converter is used for power isolation, thus achieving good electrical isolation between the various CAN nodes on the bus. The reset circuit consists of a watchdog timer MAX706 and a manual reset button. When a system fault occurs, MAX706 automatically generates a reset signal to reset the 87C196KD and SJA1000. To restart the program, the manual reset button can be used. 4. CAN Smart Node Software Design The software design of the CAN smart node mainly includes three parts: CAN initialization program, message sending program, and message receiving program. The following is the flowchart and C language source code of the Basic CAN mode CAN smart node software. a. CAN Initialization Part #include <80c196kd.h> /* Definitions of microcontroller registers to be included */ #include _SFR_H_ #include _FUNCS_H_ #define BASE_CAN 0Xa000 /* Define the base address of the CAN controller */ typedef struct { unsigned int id; /* Message identifier */ unsigned char rtr; /* Remote frame bit */ unsigned char dlen; /* Data length */ unsigned char data[8]; /* Data */ } MSG_STRUCT; /* Represent the CAN protocol frame using a C language structure */ void init_can() { *(unsigned char*)(BASE_CAN + 0) = 0x01; /* SJA1000 enters reset state */ *(unsigned char*)(BASE_CAN + 4) = 0x00; /* Initialize Receive Code Register ACR */ *(unsigned char*)(BASE_CAN + 5) = 0xff; /* Initialize Receive Mask Register AMR */ *(unsigned char*)(BASE_CAN + 6) = 0x00; /* Initialize Bus Timing Register BTR0 */ *(unsigned char*)(BASE_CAN + 7) = 0x14; /* Initialize Bus Timing Register BTR1 */ *(unsigned char*)(BASE_CAN + 8) = 0xfa; /* Initialize Output Control Register OCR */ } b. Message Transmission Section unsigned char can_send(MSG_STRUCT smsg) { unsigned char v; int i; v=*(unsigned char*)(BASE_CAN + 2); if ( v & 0x08) /* Check if data can be transmitted */ { v=smsg.id>>3; /* Identifier sent to identification code register */ *(unsigned char*)(BASE_CAN + 10) = v; v=*(unsigned char*)(BASE_CAN + 10); v=smsg.id & 7; /* Identification code 0-2 bits, RTR, DLC */ v<<=5; v+=smsg.dlen; *(unsigned char*)(BASE_CAN + 11) = v; for(i=0;i { *(unsigned char*)(BASE_CAN + 12+i) = smsg.data[i]; } *(unsigned char*)(BASE_CAN + 1) = 0x01; return(1); } else { return(0); } } c. Message receiving part unsigned char `can_receive() { MSG_STRUCT rmsg; int i; unsigned char buf1, buf2; while ((*(unsigned char*)(BASE_CAN + 2)) & 0x01) /* Check if there is any receivable information */ { buf1 = *(unsigned char*)(BASE_CAN + 20); /* Retrieve one frame of information */ buf2 = *(unsigned char*)(BASE_CAN + 21); rmsg.dlen = buf2 & 0x0f; /* Data length */ for (i=0; i< rmsg.dlen; i++) /* Retrieve data */ { rmsg.data[i]= *(unsigned char*)(BASE_CAN + 22 + i); } *(unsigned char*)(BASE_CAN + 1) = ... }` 0x04; /* Release the receive buffer */ rmsg.rtr = (buf2 >> 4) & 0x01; /* Remote frame */ rmsg.id = buf1; /* Retrieve message identifier */ rmsg.id <<= 3; rmsg.id |= (buf2 >> 5) & 0x06; switch (rmsg.id) /* Transfer to different data processing programs according to the identifier */ case …… {…… ……} break; case …… } } 5. Conclusion The innovation of this paper lies in introducing fieldbus into the distributed control system, overcoming the problems of poor real-time performance and poor communication reliability of traditional serial communication distributed control systems. The CAN intelligent node presented has been applied to the distributed control system of a power plant. After more than a year of operation, it has been found that the design scheme has good reliability, real-time performance, and flexibility. The CAN intelligent node can not only be applied to distributed control systems, but also to other distributed control systems. References: 1. Wu Kuanming. CAN Bus Principles and Application System Design. Beijing: Beijing University of Aeronautics and Astronautics Press, 1996. 2. Su Rongyan, Chang Jiupeng, Shao Liqing, Deng Kangyao. Design of Interface Communication Card for Engine Measurement and Control System Based on CAN Bus. Microcomputer Information. 2005, 1: 101-103. 3. Lai Qingmin. Multifunctional Large Grain Warehouse Remote Monitoring System Based on CAN Bus. Microcomputer Information. 2005, 7: 51-52. 4. 'PHILIPS SJA1000 Stand-alone CAN controller DATA SHEET', 2000. 5. 'PHILIPS 82C250 CAN controller interface DATA SHEET', 2000. 6. 'INTEL 87C196KD DATA SHEET', 1995.
Read next

CATDOLL 138CM Tami Torso Doll

Height: 138 Torso Weight: 18.5kg Shoulder Width: 30cm Bust/Waist/Hip: 64/59/74cm Oral Depth: 3-5cm Vaginal Depth: 3-15c...

Articles 2026-02-22
CATDOLL 135CM Ya

CATDOLL 135CM Ya

Articles
2026-02-22