D301271 1013 - FGEN - multi protocol 10-1
10 Application example FGEN for Modbus TCP with CODESYS Win V3
10.1 Used hard-/ software................................................................................................................................10-2
10.1.1 Hardware.......................................................................................................................................................................................... 10-2
10.1.2 Software............................................................................................................................................................................................ 10-2
10.2 Network configuration ............................................................................................................................10-3
10.3 Programming with CoDeSys ................................................................................................................... 10-4
10.3.1 Predefined feature sets ............................................................................................................................................................... 10-4
10.3.2 Creating a new project................................................................................................................................................................ 10-5
10.3.3 Defining the communication settings................................................................................................................................... 10-7
– Gateway definition ................................................................................................................................................................... 10-7
– Setting the communication path........................................................................................................................................ 10-8
10.3.4 Adding the Ethernet Adapter ................................................................................................................................................... 10-9
10.3.5 Adding the Modbus master ....................................................................................................................................................10-10
10.3.6 Adding a Modbus TCP slave....................................................................................................................................................10-11
10.3.7 Programming (example program)........................................................................................................................................10-13
– Small example program .......................................................................................................................................................10-13
10.3.8 CoDeSys: Global variables........................................................................................................................................................10-14
– Global variable list ..................................................................................................................................................................10-15
10.3.9 Modbus channels........................................................................................................................................................................10-15
– Modbus data mapping .........................................................................................................................................................10-16
– Setting the Modbus channels (examples)......................................................................................................................10-17
10.3.10 Building, login and start............................................................................................................................................................10-23
10.3.11 Reading out the process data.................................................................................................................................................10-25
10.3.12 Evaluation of the status word of FGEN-XSG16-5001 (%IW1) ......................................................................................10-26