WAGO-I/O-PRO CAA library The library contains two function blocks: ETHERNET_MODBUSMASTER_UDP and ETHERNET_MODBUSMASTER_TCP Using this function blocks communication with one or more slaves can be established. It is recommended to use the function block ETHERNET_MODBUSMASTER_UDP since data exchange can be handled more quickly than using the TCP block. Content 3 ETHERNET_MODBUSMASTER_UDP... 3 ETHERNET_MODBUSMASTER_TCP... 5 WAGO-I/O-PRO CAA Version 1.0.1-1
ETHERNET_MODBUSMASTER_UDP 2 ml01800e WAGO-I/O-PRO CAA
ETHERNET_MODBUSMASTER_UDP WAGO-I/O-PRO CAA Library elements Category: Communication Name: ETHERNET_MODBUSMASTER_UDP Type: Function Function block X Program Library : Requiered libraries SysLibSocket.lib Applicable to: 750-841(Release 07), 758-870(Release01) Input: Data type: Comment: xopen_socket BOOL Opens a socket on the client strip_address STRING IP address of server wport WORD Port bunit_id BYTE -According to the UnitId in protocol header -Slave-ID in a serial modbus network - Buffer index of modbus slave on a PC according to example ActiveMBTSlaveCtl. bfunction_code BYTE Supported function codes 0x1: Read Coil Status 0x2: Read Input Status 0x3: Read Holding Registers 0x4: Read Multiple Register 0x5: Force Single Coil 0x6: Write Single Register 0x7: Read Exception Status 0x0F: Write Multiple Coils 0x10: Write Multiple Register 0x17: Read and Write Multiple Registers wread_address WORD Start address for reading commands. wread_quantity WORD Number of data for reading. ptread_data Pointer to array, where the read data will be stored. wwrite_address WORD Start address for writing commands. wwrite_quantity WORD Number of data for writing ptsend_data Pointer to array, where the data, which shall be written, are placed. ttime_out TIME Time within the slave ought to respond to the request. InOut: Data type: Comment: xsend BOOL Send modbus request. This variable will be reset by the functionblock. Output: Data type: Comment: WAGO-I/O-PRO CAA Version 1.0.1-3
ETHERNET_MODBUSMASTER_UDP WAGO-I/O-PRO CAA Library elements xis_open BOOL Socket is created on the client. Client ready to send modbus request. werror WORD 0x0000 Succesful 0x0001 Illegal function code 0x0002 Illegal data address 0x0003 Illegal data value 0x0004 Slave device failure 0x0005 Acknowledge 0x0006 Slave device busy 0x0007 Negative acknowledge 0x0008 Memory parity error 0x000A Gateway path unavailable 0x000B Gateway target no respond 0x0079 no socket available 0x0097 Illegal number of points 0x0098 Internal buffer overrun 0x0099 - TimeOut bresponse_unit_id BYTE According to the UnitId in protocoll header Graphical description: Description: Using ETHERNET_MODBUSMASTER_UDP the IPC becomes a Modbus-Master. First a socket has to be opened by the input xopen_socket. If the socket could be opend the output xis_open will show TRUE. Otherwise the werror output will display 0x79. Modbus requests can be send by setting the IN_OUT variable xsend to True. The function block will reset this variable after execution of the command. If the slave does not respond within the time ttime_out error code 0x99 will be displayed. The function block ETHERNET_MODBUSMASTER_UDP uses UDP as protocoll(user Datagramm Protocoll) This allows quicker data exchange than using TCP protocoll. 4 ml01800e WAGO-I/O-PRO CAA
ETHERNET_MODBUSMASTER_TCP WAGO-I/O-PRO CAA Library elements Category: Communikation Name: ETHERNET_MODBUSMASTER_TCP Type: Function Function block X Program Name of library: Requiered libraries SysLibSocket.lib Applicable to: 750-841(Release 07), 758-870(Release01) Input: Data type: Comment: xconnect BOOL Establishes the connection to the server strip_address STRING IP address of server wport WORD Port bunit_id BYTE -According to the UnitId in protocoll header -Slave-ID in a serial modbus network - Buffer index of modbus slave on a PC according to example ActiveMBTSlaveCtl. bfunction_code BYTE Supported function codes 0x1: Read Coil Status 0x2: Read Input Status 0x3: Read Holding Registers 0x4: Read Multiple Register 0x5: Force Single Coil 0x6: Write Single Register 0x7: Read Exception Status 0x0F: Write Multiple Coils 0x10: Write Multiple Register 0x17: Read and Write Multiple Registers wread_address WORD Start address for reading commands. wread_quantity WORD Number of data for reading. ptread_data Pointer to array, where the read data will be stored. wwrite_address WORD Start address for writing commands. wwrite_quantity WORD Number of data for writing ptsend_data Pointer to array, where the data, which shall be written, are placed. ttime_out TIME Time within the slave ought to respond to the modbus request. tcon_watchdog TIME Time within the server ought to respond if the connection is to be established. WAGO-I/O-PRO CAA Version 1.0.1-5
ETHERNET_MODBUSMASTER_TCP InOut: Data type: Comment: xsend BOOL Send modbus request. This variable will be reset by the functionblock. Output: Data type: Comment: xis_connected BOOL Connection to the server is established. werror WORD 0x0000 Succesful 0x0001 Illegal function code 0x0002 Illegal data address 0x0003 Illegal data value 0x0004 Slave device failure 0x0005 Acknoledge 0x0006 Slave device busy 0x0007 Negative acknowledge 0x0008 Memory parity error 0x000A Gateway path unaviable 0x000B Gateway target norespond 0x0079 No socket available 0x0080 Can not send modbus request 0x0096 Server not available 0x0097 Illegal number of points 0x0098 Internal buffer overrun 0x0099 - TimeOut bresponse_unit_id BYTE According to the UnitId in protocoll header Graphical description: Description: 6 ml01800e WAGO-I/O-PRO CAA
Using ETHERNET_MODBUSMASTER_TCP the IPC becomes a Modbus-Master. Number of slaves is only limited by the modbus protocoll. The function block ETHERNET_MODBUSMASTER_TCP uses TCP as protocoll. The function block ETHERNET_MODBUSMASTER_TCP is recommended to use, if the modbus slave only supports TCP protocoll rather than UDP. Warning: This function block may block on the 750-841. It is therefore strongly recommended to use this function block in an own task. WAGO-I/O-PRO CAA Version 1.0.1-7