1

I'm using modbus_t to establish communication between PC and Siemens PLC (I'm not so familiar with modbus.h library). To read and write, I'm using

modbus_write_registers()
modbus_read_registers()

to realise vehicle control. However these two functions takes around 200ms, respectively, which is too long and fails to reach the minimum control frequency.

So, I want to ask if this is the common situation for these two functions, or caused by hardware?

CaTTTTTy
  • 11
  • 1
  • How are you measuring the time these functions take? You might also get more help if you provide the code for how you're calling those functions. Also you have this question tagged `ros`, why are you using modbus on top of that? – BTables Feb 10 '23 at 20:43

1 Answers1

0

Modbus is relatively slow compared to other industrial protocols, and is not a real-time or deterministic protocol. If you are looking for faster response times, spend some time to research setting up Profinet or EtherCAT if your application can be retrofitted with it. Both are very common, and fast industrial protocols.

Which PLC are you interfacing to? Siemens S7-1200 and other Siemens processors come equipped with Profinet right out of the box.

There is a library for Profinet at the following link posted on Github. You may want to give that a try.

https://github.com/rtlabs-com/p-net

And the documentation...

https://rt-labs.com/docs/p-net/_copied/README.html