Modbus di PLC Siemens S7-1200 and S7-1500

Buat programmer PLC Siemens, protokol modbus merupakan momok yang cukup menakutkan. bukan hanya di program juga di hardware yang menjelimet dan mahal

Salah satu inovasi di software terbaru TIA Portal untuk PLC Siemens S7-1200 dan S7-1500 di STEP7 V12 adalah dimasukkannya perintah baru yaitu komunikasi MODBUS TCP dengan PLC Siemens S7-1500

  1. S7-1500 as MODBUS server with S7-1200 as MODBUS client
  2. S7-1500 as MODBUS client with S7-1200 as MODBUS server

Requirements:
To establish a MODBUS RTU communication it is necessary a High Feature Comunication Module, (not Basic )

HW configuration:
Device View, Communication Module properties, Port Configuration, Protocol: set to MODBUS

Programming:
Blocks needed:
As master: Modbus_Comm_Load / Modbus_Master
As slave: Modbus_Comm_Load / Modbus_Slave

Call: call both block unconditionally

REQ:
Modbus_Comm_Load: use first scan bit
Modbus_Master: should be set (0->1) every time you need to execute a job. My tip: use a 1s clock for the first tests, it slow enough to be observed by eye. When functional, you can change it for a faster clock (e.g. 100ms).

Modbus_Comm_Load parameters:
e.g. follow the online help.
MB_DB: should be connected to the variable MB_DB from the instance DB of the blocks

Mode:
Mode is not an external parameter but else an internal FB variable. It should be set to the operation mode (see online help; e.g. RS232=0, 485=4) before the call the Modbus_Comm_Load.

Other communication parameters:
MODBUS RTU uses 1 startbits, 8 databits, 1 Stopbit (up to now, not configurable).

TIPs:

There is two ways to build a MODBUS TCP communication:

  1. With configured connection (defined in Network View), and that uses a communication DB with structure TCON_Configured.
  2. With programmed connections (defined directly in the communication definition DB), and that uses a communication DB with structure TCON_IP_v4.

A simple way to build a TCON_IPv4 DB is to place, in your program a block TSEND_C, and use the properties of the block to create and configure the DB. After that you can delete the TSEND_C call, the TSEND_C block and its respective instance DB and just uses the create connection DB to MODBUS TCP proposes.

You can create alternatively to create an usual DB and inside to create a variable with the data type TCON_IP_v4 (type this name directly to the data type field).When to configure this DB, take in account:

  • As server, Active Established should be “False” and remote port should be “0”
  • As client, Active Established should be “Ture” and remote port should be set with the server port number

MB_DATA_PTR could has absolute or symbolic address:

  • Absolute address (M area or S7-300/400 compatible DB’s) is designed for a pointer (for example P#M0.0 byte 10). When used with DB’s, the DB could have any data type structure.
  • Symbolic address (optimized DB – default for S7-1500). In this case it is allowed array of word or integer data types

 

info : cek link support siemens dengan “sample program: modbus TCP with S7-1500”

 

Leave a Reply

Your email address will not be published. Required fields are marked *