CP340 MODBUS master slave station

As we all know, MODBUS is one of the more commonly used communication protocols. It can be divided into two modes: MODBUS RTU and MODBUS ASCII. The MODBUS RTU mode is more commonly used, especially in DCS systems or inverters. Somewhat is: Can provide greater data throughput than ASCII mode at the same baud rate.

MODBUS is a master/slave serial communication protocol where only one device (host) can request data exchange (called "query") while other device (slave) to provide data to host or execute host's query command The method responds to the host. The MODBUS protocol defines the format of the query message and the format of the slave response. The host query message includes the address, function code, data, and CRC check. The slave response message includes the address, function code, data, and CRC check. If the slave encounters an error in accepting the message or the slave cannot execute the received command, he will generate an error message and send it as a response to the host. The process is as follows:

In addition, there are also many SIEMENS PLCs used in the project. However, when the S7-300 PLC is used as a MODBUS master/slave station, the official proposal is to use the CP341+DOUGLE mode. This mode is characterized by more convenient use, but the disadvantage is that the cost is too high. .

For the above features, the CP340 (or PTP CPU or S7-200) has been developed as a master/slave station program. The main advantage of this mode is its strong replication and low cost, and it is not necessary to buy DOUGLE every time.

1, CP340/PTP CPU/S7-200 MODBUS master function

The MODBUS protocol freely organizes program code to communicate with slave stations. It supports function codes 1, 2, 3, 4, 5, 6, 15, 16 and CRC check according to requirements, and is flexible to reduce PLC memory resources. Has been successfully used in inverter communication, temperature control table communications and other fields.

2, CP340/PTP CPU/S7-200 MODBUS slave function

Freely organize program code for MODBUS protocol to communicate with the master station. Support function codes 1,2,3,4,5,6,15,16 according to requirements. The master station can query DI/DO, MW area, AIW area, DB area (Generate standard MODBUS register addresses, such as 00001, 10001, 30001, 40001 registers), flexible application, reduce PLC memory resources. Has been successfully used in Luzhou Beer, Changchun Oil Well, Chengdu Water Treatment and other projects. The following is an example of the use of CP340 as a MODBUS slave station in Chagan Oilfield, Changchun:

Changchun Chaganhua Oil Well CP340 AS MODBUS SALVE

Note: With the development of the network, there are a lot of TCP/IP-MODBUS or PROFIBUS DP/MODBUS in use, but the corresponding gateways are required and the cost is high.