Print

Communication with Siemens S7-400 and redundancy function with S7-400H

Ethernet IP Configuration S7-400/300 and HMI

Use HMI-Tool V7.0.0.14 or higher

Select the correct protocol and set the Ethernet IP address of the HMI. If need, see also HMI Ethernet IP address

Set the Ethernet IP of the S7-400. If redundancy, set the second IP address.

Set the station, rack and slot numbers in the special LW registers for the S7-400 protocol.

  • Station number «plcsta»
    • Station number range «plcsta» (0-255), if it exceeds this range, then the default will be 2.
  • Rack number
    • LocalWord[45000+plcsta*2]: Contains the rack number of the station. The range is 0 to 7, if higher, the default value will be 0.
  • Slot number
    • LocalWord[45001+plcsta*2]: Contains the slot number of the station. The range is 1 to 31, if higher, the default value will be 1.

Example, for Station number 2 : Enter the station number in LW[45004] and the slot number in LocalWord[45005]

These LocalWord[45xxx] can be set with a Macro in «Init Script»:

Run the script once at startup

Redundancy function, for CPU in case of S7-400H

Use HMI-Tool V7.0.0.14 or higher and use «forced update HMI» before dowalod you project for all Ethernet HMIs

The redundancy function allows automatic switching from one IP to another if communication fails.

But for S7-400, you need to change at least the Slot number. For this, we will use a macro to also change the Slot number if the current IP changes.

Macro in «Global Script», call macro every 1000 ms as example:

#include "MacroInit.h"
void Macro_main(IN *p)
{
MarcoInit
//ToDo
int plcsta=0; PLC Station number
if(192 == LocalWord[63192] && 168 == LocalWord[63193] && 10 == LocalWord[63194] && 1 == LocalWord[63195])
{
// 192.168.10.1
LocalWord[45000+plcsta*2] = 0; // Rack number
LocalWord[45001+plcsta*2] = 2; // Slot number
}
else if(192 == LocalWord[63192] && 168 == LocalWord[63193] && 10 == LocalWord[63194] && 2 == LocalWord[63195])
{
// 192.168.10.2
LocalWord[45000+plcsta*2] = 1; // Rack number
LocalWord[45001+plcsta*2] = 2; // Slot number
}
}