Modbus TCP messaging with M340 PLC

squb

Member
Join Date
Nov 2020
Location
Adelaide
Posts
2
Hi Guys,

I have a project that requires a M340 PLC to communicate with a PM5340 power meter over Modbus TCP. I have previously used the same type of PLC to communicate with a device over RS486 but I cannot find how to setup the PLC to communicate4 over TCP. I have proved the communications using a simulate program called Modscan. Side note, Only the second time iv ever looked at a schneider plc so I am still getting used to the format (%MW, %IW, etc...).

Any help would be greatly appreciated!

The Details are as follows:
PM5340 Power Meter:
- Device (slave) ID:255
- IP:192.168.1.17
- Address to be read: 3028
PLC:
- IP: 192.168.1.25

eth1.PNG eth2.PNG prog1.PNG table1.PNG modscan.PNG
 
Do you have a NOE card in the m340? If so you will use IO scanning
If not then you will have to use READ_VAR or Write_VAR function blocks (Part of the unity library to handle the comms. You can check in the help file how those blocks work and there is also some videos online
 
Welcome to forum!


Look this thread.

I assume from screenshots that you have only CPU with inbuild ethernet. If so only method is on M340 now communication function blocks like read_var and write_var.
http://www.plctalk.net/qanda/showthread.php?t=126814


Good news are that communication is builded same than for master on RS232 / RS485 port.

You only need to change ADDM block to point address '0.0.3{192.168.1.17}255 or if not working then try '0.0.3{192.168.1.17}TCP.MBS

p.s You only need configure communication address list if you want to block communication from other masters than IPs write at communication list.

(Well, on older P57 PL7 and Unity series PLC TCP communication needed this list also for TCP master communication out from PLC to slaves, because IP address was gived by xway address for communication block.)

With M340 and M580 xway address table isn't needed anymore and you need onöy change addm blocks pointing address to different.
If you have sepeareate NOE card on M340, then you can also use io-scanner configuration.
 
Thanks Guys!

Lare you you nailed it, i was nearly there but the address on the ADDM block was wrong.. I have attached a screenshot of the working result if anyone needs the example as well. I also had to word swap the double integer to make sense of the float32 value that is output by the power meter.

Worth noting is that you have to use curly brackets for the IP, normal brackets wont work. The starting register needed to be offset by 1 so 3028 is read by pointing to 3027. The words are swapped as shown in the screenshot to get a readable value, not sure if anyone has a more efficient way of doing this!??

WorkingResult.PNG
 

Similar Topics

Hi all, I’m developing a critical application in a TSXP574634M Premium Telemecanique processor (With Unity Pro and native Ethernet port). The...
Replies
1
Views
4,700
I have a PH meter that I am trying to bring its data into 1756-L81. I have downloaded the Rockwell MODBUS AOI kit, but I am not sure if I need to...
Replies
5
Views
147
Hello gentlemen, Im working on a small project on TIA Portal, about establishing a Modbus TCP connection between my ET200SP plc and a socomec...
Replies
12
Views
305
If a device has Modbus RTU over serial and Modbus RTO over TCP and Modbus TCP then there is a difference between Modbus RTU over TCP vs Modbus TCP...
Replies
7
Views
476
Hi There. I have PC to get few tags from PLC into C# windows forms application. What is the best and fastest way? I could not find Omron in...
Replies
3
Views
264
Back
Top Bottom