You can create it as a single or multi-instance block-it doesn’t matter.Įven though in this tutorial, we’re parameterizing the load block first, in your project, make sure Modbus_Comm_Load is called in a rung ABOVE Modbus_Slave. Like with the Modbus_Slave block, for this tutorial, I’ve called Modbus_Comm_Load in my OB1 and created an instance data block for it. Once you’ve parameterized those two inputs, the Modbus_Slave block is complete. These make up the Modbus hold registers, and begin at register 40001, continuing for the length of my data array, to register 40010.
In this tutorial, we've pointed to an array of data (“DataArray”) within a global data block (“Modbus_server_data”).īelow, my data array ("Modbus_sever_data".DataArray) contains ten words of data that I'm exposing as a Modbus server. This pointer can be any global data block or a memory area (M), and are used for Modbus functions 3 (read Word), 6 (write Word), and 16 (write multiple Words). MB_HOLD_REG: This defines the location (start and size) for the available Holding Registers (40001 to max defined register).MB_ADDR: This corresponds to the Modbus Slave ID, which your master will use to reference this server.There are only two inputs here: MB_ADDR and MB_HOLD_REG, explained below: You can call this block anywhere in your program and store its data in a single or multi-instance data block-it won’t affect your server. Parameterizing Modbus_Slaveįor this tutorial, I’ve called my Modbus_Slave block in OB1 and created an instance data block (DB5) for it. The Modbus_Slave block is the simplest, so we'll start with that. The Modbus_Slave block configures the data in your server. The Modbus_Comm_Load block configures your connection module for communication using the Modbus RTU protocol. You can find both of these in the “Communication->MODBUS (RTU)” folder.įor reference, you would use the Modbus_Master function block to set up a Modbus master, or client, on your PLC. Siemens Modbus RTU servers center around two built-in instruction blocks, Modbus_Comm_Load and Modbus_Slave. This will configure your port to use the Modbus protocol, and to accept its port parameters from the Modbus_Comm_Load instruction, which we'll talk about later. Set the Protocol of your port to Freeport/Modbus. In your communication module's device view, navigate to the port interface (in the example image, RS-232 interface), then port configuration.
Since S7-1500 PLCs don't typically come with onboard serial communication ability, you'll need to use an adapter module that supports the Modbus RTU slave protocol, with a port interface that meets your system connection requirements. Need to make data available from your 1500 PLC to a Modbus RTU master?Īs long as you have a Modbus RTU capable serial communications adapter module, setting up a Modbus RTU server is pretty simple.