Here you go. Sample read. The 1st part is the program definition + variables. The 2nd part is the code.
PROGRAM PLC_PRG
VAR
MBTCPMast :ETH_MOD_MAST; (* ModbusTCP master function block *)
pollTON :TON; (* Timer for message polling *)
MBinData : ARRAY[1..10] OF WORD; (* Data read from remote device *)
END_VAR
VAR_GLOBAL CONSTANT
MBfcode_ReadRegs : BYTE := 3;
MBfcode_WriteRegs : BYTE := 16;
END_VAR
(*-----------------------------------------------------------------*)
pollTON(IN:= NOT pollTON.Q, PT:= t#100ms, Q=> , ET=> );
MBTCPMast(
EN:= pollTON.Q,
SLOT:= 0,
IP_ADR:= IP_ADR_STRING_TO_DWORD('192.168.1.2'),
UNIT_ID:= 0,
FCT:= MBfcode_ReadRegs, (* Modbus function code *)
ADDR:= 0, (* Modbus address = 400001*)
NB:= (SIZEOF(MBinData)/2), (* Communications block size (in words, not bytes) *)
DATA:= ADR(MBinData), (* Pointer to ComBlock *)
DONE=> ,
ERR=> ,
ERNO=> );