S71200 CB1241 Module Modbus RTU Communication Application

Author: zhddq
Published on: 2025-02-10
Category: Industry News

1、 Module Introduction

CB1241RS485 allows the S71200 CPU to connect to other Modbus devices through this module, achieving the communication function of the S71200 Modbus RTU master station.

The CB1241 RS485 module also supports communication connections such as USS and point-to-point PtP. The appearance of this module is shown in the following figure.

The wiring terminals and connections for the CB1241 RS485 module are as follows:

2、 Configuration Introduction

This example introduces the installation of CB1241RS485 module with two CT Uni SP drivers on S71200 CPU1215DC/DC V4.0 CPU.

1. Open TIA V13 software, create a new project, specify the project name and storage path. Click on the 'Left Explorer Window'

Select 'Add New Device' in the 'Add CPU Type' section. In this example, select the S71200 1215 DC/DC CPU. From the hardware list on the right side of the window, select the CPU model and hardware version, and then drag it into slot 1 to complete the CPU addition.

Then select "Communication Board" from the hardware list on the right - under "point to point", choose CB1241, select the firmware version, and drag it into the unique CB slot on the CPU module to complete the hardware addition. Simultaneously set CPU Ethernet port IP

Address, CPU and other related parameters.

2. Connect the communication cable.

SP terminal wiring diagram

3、 Programming and compilation downloads.

1. Programming. The TIA software includes the S71200 modbusRTU master communication package, which only needs to be correctly called and set parameters when applied. The Modbus RTU in the TIA library contains three instructions (Modbus Com_Load, Modbus Master, Modbus Slave), and CB1241 Modbus RTU master communication uses "Modbus Com_Load" and

Two communication blocks, Modbus Master. The 'Modbus_Cmm_Load' block only needs to be called once to initialize the Modbus communication port, usually executed during the first scan. The 'Modbus_Saster' block is used for the main station

Read and write register data from the slave module.

Select "Program Block" - "Add Program" from the project list on the left side of the window to add an FC block and two global DB blocks. The FC block writes the communication program, while the DB block stores the data written and read by the two drives. Double click to open FC block

Enter the programming interface, find "MODBUS" under the right-hand command, and then find "Modbus_Cmm_Load" and

“Modbus_Master”。 When calling the 'Modbus_Cmm_Load' command, it will require the creation of a background data block. Use automatic background data block creation, and then set communication parameters according to specific communication requirements. Call 'Modbus_Saster'

When it comes to creating background data blocks, automatic background data block creation can be used, and communication parameters can be set according to specific communication requirements for reading or writing. Save after completion, open the main program and call the FC block in the main program.

Note: When calling "Modbus_Cmm_Load", enter the parameter "MB_SB" as the name of the background data block created when calling "Modbus_Saster". Example CB1241 communicates with two drivers to read and write four consecutive parameters respectively

Four consecutive parameters. Under programming

2. Compile and download. Save the project after completion. Right click on the project name and select "Hardware and Software" under "Compile" to compile. If there are no errors, it will display normally. After completion, you can right-click on the project name and select "Hardware and Software" under "Download" to download software and hardware, or you can download software or hardware separately. Select the download connection method in the pop-up interface.

3. Operation status and online diagnosis. After the download is completed, the PLC enters the running state, which can be accessed through the "Online" menu bar to view the configuration and program running status and perform online diagnosis.

Explanation: Through experimental testing, it has been found that when communication drops or communication is abnormal through CB1241 Modbus RTU master station communication, the PLC will not give any alarms, and the execution status of the "Modbus_Saster" block will not change,

Therefore, communication is not guaranteed when using this communication method. Users need to write their own programs to verify that communication is still normal. This example comes with a verification program for reference only.

When communication is normal

After disconnecting the communication line of Station 1

 

Share

Recommended Posts

  • 返回顶部