CAN Bus and Its Application on Emerson CT PLC

Quote:
The rapid development of digital electronic information technology has increasingly played a huge role in promoting the manufacturing industry in the world, making the design of various devices in the manufacturing industry more and more electronic, digital and networked. The ECCT product is a product introduced by Emerson CT. The special PLC controller with CAN bus protocol specially applied in the textile industry not only satisfies the basic I/O process requirements of textiles, but also integrates the CAN bus protocol perfectly so that users can easily put all kinds of systems into the system. The device is connected via the CAN protocol. This article describes the application of the CAN bus function on Emerson CT PLC.

Introduction to CAN bus basics

The CAN bus (CONTROLLER AREA NETWORK, controller local network) was first proposed by Germany's BOSCH company. The CAN bus is a bus widely used in the industry today. Its characteristics are briefly summarized as follows:
1) The CAN controller operates in a multi-master mode, and each node in the network can compete to send data to the bus using a lossless structure in a bit-by-bit arbitration based on the bus access priority (depending on the message identifier). The use of RS-485 can only constitute a master-slave structure system, the communication method can only be carried out by the master station polling method, the system's real-time, poor reliability.

2) The CAN protocol abolished the traditional station address coding, and instead of encoding the communication data, it has the advantage that the number of nodes in the network is theoretically unlimited, and addition or reduction of equipment does not affect the work of the system. . At the same time, different nodes can receive the same data at the same time. These characteristics make the data communication between the nodes of the network formed by the CAN bus in real time strong, and easily form a redundant structure, improve the reliability of the system and the flexibility of the system.
3) The CAN bus is connected to the physical bus through the two outputs CANH and CANL of the CAN controller interface chip, while the status of the CANH terminal can only be high or hovering, and the CANL terminal can only be low or hovering. In this way, it will be ensured that there will be no phenomenon similar to the system error in the RS-485 network, which will lead to the phenomenon that multiple nodes send data to the bus at the same time, causing the bus to be short-circuited and damage some nodes. Moreover, the CAN node has the function of automatically shutting down the output in the event of a serious error, so that the operation of other nodes on the bus is not affected, so as to ensure that there will not appear in the network, because the individual nodes have problems, so that the bus is in a "deadlock" status.
4) The complete communication protocol that CAN has can be implemented by the CAN controller chip and its interface chip, which greatly reduces the difficulty of the user's system development and shortens the development cycle. These are only RS-485 with electrical protocols unmatched. .

5) Compared with other field buses, the maximum rate of CAN bus communication can reach 1MBPS, the transmission rate is 5KBPS, the use of twisted pair, transmission distance up to 10KM, and high reliability of data transmission; CAN bus is a high communication rate A field bus that has formed an international standard with many features such as easy to implement, and high cost performance. These are also important reasons why CAN bus is used in many fields and has strong market competitiveness.

The difference between CAN bus and RS485 mode:

characteristic

RS-485 method

CAN bus

Topology

Straight line topology

Straight line topology

Transmission medium

Twisted pair

Twisted pair

Hardware cost

Very low

Increase in cost per node

Bus utilization

low

high

Network characteristics

Single main structure

Multi-master structure

Data transmission rate

low

Up to 1Mbps

Fault Tolerance Mechanism

no

Completing error handling and error detection mechanisms by hardware

Communication failure rate

Very high

Extremely low

The effect of node errors

The faulty node may lead to the entire network.

Failure node has no effect on the entire network

Communication distance

<1.2Km

Up to 10Km (5Kbps)

Post-maintenance costs

Higher

Very low

CAN bus system structure: Each CAN bus node needs to have a CAN protocol control chip and an appropriate interface circuit. The nodes are connected through a twisted-pair shielded cable for bus connection. The first and last nodes need to be connected with a 120R matching resistor, and the maximum communication rate can be achieved. 1MBPS, the lower the transmission rate, the longer the transmission distance. The system structure is as follows:

CAN message format: CAN protocol supports two message formats CAN2.0A and CAN2.0B; CAN2.0A is the standard format, CAN2.0B is the extended format; the formats are as follows:

CAN2.0A protocol message structure is as follows

CAN2.0B protocol message structure is as follows

The only difference between the standard format and the extended format is that the identifier (ID) length is different, the standard format is 11 bits (ID10-ID0), and the extended format is 29 bits (ID10-ID0, EID17-EID0).

In the standard and extended formats, the start of the message is called the start of frame (SOF), the start of the frame start marker data frame or the remote frame, and consists of a single "dominant" bit (0). It is done automatically by the control chip and does not need to be reflected in the program.

This is followed by an arbitration field consisting of an 11-bit identifier (ID10-ID0) (extended format is 29 bits (ID10-ID0, EID17-EID0)) and a remote send request bit (RTR). The RTR bit indicates whether it is a data frame or a request frame. There is no data byte in the request frame.

The control field includes an identifier extension bit (IDE) that indicates whether it is a standard format or an extended format. It also includes a reserved bit (RBO) for future expansion. Its last four bits are used to indicate the length of the data in the data field (size is binary data consisting of DLC3-DLC0). The data field ranges from 0 to 8 bytes (DATA FIELD) followed by a cyclic redundancy check (CRC) that detects data errors.

The acknowledgment field (ACK) includes the response bit and the response delimiter. The two bits sent by the sending station are recessive (logic 1). At this time, the receiving station correctly receives the message and sends the master level (logical 0) to cover it. In this way, the sending station can guarantee that at least one station in the network can correctly receive the message.

The end of the message is marked by the end of the frame. There is a very short interval between the two adjacent messages. If there is no station for bus access at this time, the bus will be idle.

Emerson CT PLC integrated CAN bus function introduction

The CAN communication function of ECCT supports CAN2.0A protocol and CAN2.0B protocol. The communication baud rate is set in the range of 5-100KBPS. It can be set by Controlstar FOR ECCT. The specific use steps are as follows:

1) Basic settings: Double-click on “System Block” in the Project Manager, select “CAN Port Settings” in the popup window, select “Free Protocol” in “CAN Port Parameter Settings”, and then click on “Free Port Settings” "Buttons. In the pop-up window, select the protocol type "2.0A" or "2.0B", then select "Baud Rate" and click "OK" to download the system block to the PLC.

2) Data transmission: Using the CANXMT command and taking the CAN2.0A protocol as an example to describe the correspondence between them.

3) Data reception: Use the CANRCV instruction (parameters are as follows) or use the CAN receive interrupt function. I recommend that it is more convenient for the initial user to use interrupts. For specific usage, refer to the following example program.

According to the integrated CAN bus function of ECCT, the author has been successfully applied to textile machinery. Now it is introduced as follows: The overall structure of CAN system is as follows:

The specific process of this system is not introduced. Only the application of CAN communication part will be introduced here.

Instructions for use of the program are as follows:

1. First set the CAN communication port in the "system block" as required.

2. Data sending part: The program that needs to be written to send 4 word data "16#1122,16#3344,16#6789,16#1234" to the address with ID 5 is as follows:

Among them should pay attention to: 1) CANXMT carries out the instruction for the rising edge, M1000 is the execution condition of the instruction, when it appears OFF -> ON change, carry out CANXMT instruction; 2) Before using CANXMT instruction, write the address of this assignment well 3) Send data only to take the low 8 bits of the D component; 4) No CANID on the network, CAN frames with the same data appear at the same time; 5) ID is reserved 0. 6) The verification part of the CAN program is completely completed by hardware. User programs do not need to participate.

3. Data Receiving Section: This section uses the interrupt mode to receive data as an example. It is divided into 2 steps:

1) First set the CAN interrupt enable in the main program.

2) Set the interrupt program attribute, select its interrupt event as 48 (ie, CAN receive interrupt), and then write the program to transfer the received data to the required address. Note that the ID address is a double word structure, SD282-290 is the data in order High and low bytes, pass them to the corresponding data registers and merge to get the complete data.

Summary: Because the CAN protocol format is relatively simple, and a considerable part of the work is done by the hardware of the CAN control chip, the programming procedure is relatively simple and easy to implement. After this textile system adopts the CAN communication method, the speed is greatly improved and the system is more stable, and is subject to users. The affirmation.

Truck Dash Cam

best dash cam for truckers,semi truck dash cam,keeptruckin dash cam,commercial vehicle camera systems

Shenzhen Zhitong Yingchuang Electronic Technology Co., Ltd. , https://www.sjcarautoparts.com