EasyManua.ls Logo

Siemens SIMATIC S7-1200 Easy Book

Siemens SIMATIC S7-1200 Easy Book
122 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Communications
6.2 PtP, USS, and Modbus communication protocols
Easy Book
80 Manual, 05/2009, A5E02486774-01
6.2.3 Library of Modbus instructions
The MB_COMM_LOAD instruction configures a port on the
CM module for Modbus RTU protocol communications.
You can use either the RS232 or the RS485 CM module.
Your user program must execute the MB_COMM_LOAD to
configure a port before either a MB_SLAVE or a MB_MASTER
instruction can communicate with that port.
The MB_MASTER instruction allows your user program to
communicate as a Modbus master. You can access data in
one or more Modbus slave devices.
An instance data block is assigned when you place the
MB_MASTER instruction in your program. Use this DB to
specify the MB_DB parameter on the MB_COMM_LOAD
instruction.
Execute all MB_MASTER instructions for a given port from the
same OB (or OB priority level).
The MB_SLAVE instruction allows your user program to
communicate as a Modbus slave. A Modbus RTU master can
issue a request and then your program responds via
MB_SLAVE execution.
You assign a unique instance DB when you place the
MB_SLAVE instruction in your user program. You use the DB
name when you specify the MB_DB parameter on the
MB_COMM_LOAD instruction.
Execute all MB_SLAVE instructions from a cyclic interrupt OB.
The Modbus instructions do not use communication interrupt events to control the
communication process. Your program must poll the MB_MASTER or MB_SLAVE
instructions for transmit and receive complete conditions.
If a port is to respond as a slave to a Modbus master, then that port cannot be used by
MB_MASTER. Only one instance of MB_SLAVE execution can be used with a given port.
Likewise, If a port is to be used to initiate Modbus master requests, that port cannot be used
by MB_SLAVE . One or more instances of MB_MASTER execution can be used with that
port.
If your program operates a Modbus slave, then MB_SLAVE must poll (execute periodically)
at a rate that allows it to make a timely response to incoming requests from a Modbus
master.
If your program operates a Modbus master and uses MB_MASTER to send a request to a
slave, then you must continue to poll (execute MB_MASTER) until the response from the
slave is returned.

Table of Contents

Related product manuals