Modbus TCP - confusion over implementation

sczot

Member
Join Date
Nov 2017
Location
cz
Posts
79
Hello all,
our company decided to implement some Pick to light(poka yoke) system.
There will be a lot of inputs/outputs all around the floor connected to it, so we decided to use some industrial buses (TURCK - TBEN-L1-16DXP) connected to PLC (FX3G with ENET-502 card)

but there is noone with needed experience with modbus tcp, so there i a lot of confusion and as someone responsible for project im starting to feel a little bit overhelmed since my experience with industry comunication protocols i very close to zero

1) do i need switch to make it work? (PLC <> switch <> buses) or can i connect buses directly to PLC?

2) Ive read manuals about modbus, but im somehow confused with master/slave, server/client terminology...
master/slave is used for serial link?
server/client - it looks to me like my controling plc should be client and buses servers :/ but it doesnt make sense to me

3) is there some comprehensive flowchart of how modbus message are formed, send, recieved and responded? (like what conditions have to be met to have succesful comunication between PLC and BUS?)

Thanks in advance to everyone willing to help
 
If your equipment allows (I would use Modbus TCP/IP) protocol as I think it is much easier to work with.

With modbus tcp/ip you don't have to worry about making sure each unit has a modbus address(ID) just as long as each unit has it's own IP address and port 502 is open.

the function codes will determine what range of addresses you will be reading/writing.
Example: Function code 03 would be reading the holding registers (40000-49999) (Note:if your device uses the extended addressing your addresses will be (400000-465535).

Function code 01 would read the coil register (00001-09999) Extended (000001-065535)

To write to a holding register address you would use function code 06 (single element write or you could use function code 16 which allows you to write several elements at one time.)

Modbus.org would be a good place to learn much more about modbus.
 
Last edited:
The TURCK - TBEN-L1-16DXP is a remote Input Module with Modbus/TCP ... not a bus.

The bus in your case will be a raw Ethernet and you will need to connect all in the same way as if the modules and the PLC were computers in a local area network, that's using a central switch.

You can choose between using a normal switch, cable or connectors like those in an office or more rugged industrial material.

If those Turck modules use some non standard Ethernet connectors then you will need specific connectors or whatever it use.

Then assign IP's to each module and PLC and execute Modbus/TCP read/write instructions in the PLC program.

Take in account that this system will have a relative high latency, depending on program execution times and how many inputs you will have, it can take some tenths of second to scan all.

If you want a faster response time I will recommend to use instead CanBus or the excellent Mitsubishi CC-Link
 
Here are a couple of links that helped me out with Modbus TCP.
Regards,

thanks

The TURCK - TBEN-L1-16DXP is a remote Input Module with Modbus/TCP ... not a bus.

The bus in your case will be a raw Ethernet and you will need to connect all in the same way as if the modules and the PLC were computers in a local area network, that's using a central switch.

It was presented to us, that they can be conected in line, will have to contact dealer


Take in account that this system will have a relative high latency, depending on program execution times and how many inputs you will have, it can take some tenths of second to scan all.

Latency is not is not an issue, sice its only for Pick to light system

...or the excellent Mitsubishi CC-Link

modbus and turck was financialy forced decision, I was in favor of using mitsubishi´s poka yoke system as a whole (our factory is fully operated by mitsu PLCs, except few legacy machines)
 
hopefuly one last question.
I've established comunication with TURCK equipment via modbus TCP, im adressing them directly by IP, but I've wierd problem

imagine connection

PLC -> TURCK I/O 1 -> TURCK I/O 2 -> ... -> TURCK I/O N

I/O are equiped with some kind of primitive router which is allowing TCP connection over their line

my problem is that only I/O 1 is working properly, all others "forget" their I/O status as soon as I address other I/O

any ideas, what I've forget?

EDIT: It was watchdog function, by disabling it, i've solved the problem

THANKS in advance again

I'm also contacting our dealer, but his response time is sometime quite long.
 
Last edited:
It seems to me that the setup is ready to be made into a ring... in your example, TURCK I/O N would go back to the PLC. This is not necessarily required or even needed for your application, but is generally a good topology for redundancy in some installations.

What do you mean by forget the status? The readings go to a "wrong" value or you can't see the node?
How is the program done?
 
uh, my EDIT went full wrong :(

It's line topology by manufacturer's design, but there is module function "Watchdog"
it sets outputs to zero when watchdog timer reach preset value, which is by default 500ms and counting starts when connection is lost. After disabling it, modules work as expected... will turn it on once I'll measure better value for timer
 
OK, looking for advice one more time...

How to speed up Modbus tcp?
My PLC scan time is 4ms, but cycling through 4 I/O modules takes 1,8sec, not like it matter that much in this implementation, but are there some general rules/advices to speed it up?

I/O modules are passive components, so I've to scan them periodicaly to catch changes on them...

Thanks in advance again, I really appreciate help I've got sooner in this topic
 
Not sure on how the addressing works on the modules (if you can set them or if they are automatic), but generally having continuous addresses and using the same type of register would reduce the number of transactions.

If you are only using holding registers or only using input registers and if the addresses are continuous, the PLC would likely ask for the continuous address space to be sent instead of sending reg 40000 to 40005 in one telegram and 40010 to 40015 on another telegram. Some devices are smart and will do this for you...

When you scan them, do you copy full words or just bits?
 
+1 cardosocea
You need to reduce the amount of times that the Client (Master) will communicate to the Server (Slave).

Regards,
 
There may be other issues that come into play, example: is your ethernet network a 10mb or a 100mb or a 1 gb network?

There is usually some adjustments that can be made in the hardware for "Message Wait Time".

Also the I/O device may be slow at reading the "Inputs", I usually use devices that update the inputs at 1000 times a second. You can purchase device that read alot slower which usually will reduce the cost of device.

I'm sure this is just a few of the things you may need to look at. Just as "Cardosocea" suggest are you reading in more addresses then you really need?

Example: if you need to read address 40010 and 40036 and 40078 you probably would be better off reading with the start address of 40010 and reading 68 elements as to using 3 separate read command at each address.
 
Just wanna thank you all, did cut almost 50% of latency down, and project is working fine.

You take me from modbus zero to local hero in almost no time

THANK YOU ALL
 

Similar Topics

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
348
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
161
I contacted Hach and bought a kit they recommended for a customer to add Modbus TCP capability to his Chlorine Analyzer with a SC4500 controller...
Replies
8
Views
193
I’m trying to read values from a device that can either send registers as 32 bit or a pair of 16 bit but if I understand right, the micro can only...
Replies
26
Views
672
Does anyone have any recommendations for Electronic Circuit Breakers with 0V Terminals built-in and Fieldbus (IO-LINK, MODBUS TCP, EtherNet/IP?)...
Replies
2
Views
167
Back
Top Bottom