To make the M340 communicate depends on what model of M340 you have. The lower end model with built in Ethernet (BMX P34 20x0) will need explicit message code if it is to act as a ModbusTCP Client (ie polling the server ( USP-104_B10) to send or receive information. If the M340 has a separate ethernet card (BMX NOE...) it will support I/O Scanning and then all that is required is to fill out a table with the IP address, master and slave register addresses.
If you have a M340 with built in ethernet it may be easier for it to be the ModbusTCP server (ie responds to requests from the client) as that requires minimal setup on the M340.