Today is...
Tuesday, August 20, 2019
Welcome to the Modbus Community, about
the world's leading automation protocol.
Siemens S7-300 PLC as a Modbus TCP Slave or Master
How can a S7-300 CPU315-2 DP with a CP343-1 communicate as a Modbus TCP slave or master?
By David Wisti on 22 November, 2006 - 3:16 pm

Can a Siemens S7-300 CPU315-2 DP with a CP343-1 Ethernet card communicate as a Modbus TCP slave or master? If so, is there any example code someone is willing to share?

Hi, I told you that siemens do not offer ModBus Communications but I found ET200S-modbus_SIprod_info_76.pdf file where is described a possibility using ET 200S Serial Interface Modbus/USS Module,


By Yesid Hernandez on 6 December, 2006 - 9:25 pm


I have a similar app, but with a S7-224 CPU and the CP231-1 Ethernet Interface, I will like to know if anyone have any idea to get the Modbus/TCP slave configuration working with this equipment. Thanks.

If I am not wrong Siemens do no offer ModBus communications, anyway with a Siemens S7-300 CPU315-2 DP with a CP343-1 you could get communications using Profibus DP (may be you can also use Profibus FMS)

I hope this helps you, you can send me a mail to autcon20ATyahooDOTcomDOTar

You require a Point-to-Point Communications Module CP341 installed in the rack along with the Modbus Dongle to activate the Modbus Drivers. I have documentation if you need further info.

Regards - Richard

By David Wisti on 28 November, 2006 - 9:51 pm


Thanks for the info, I didn't know about the CP341 and Modbus. Actually, I'm looking for a Ethernet solution using function codes FC60 AG_LRECV and FC50 AG_LSEND with an Ethernet CP. The CP341 is a serial port (RS232/422/485) and that solution is Modbus RTU not TCP. Siemens does have an Open Modbus library but I can't seem to find any information other than a part number:



By Daniel Chartier on 29 November, 2006 - 9:04 pm

Hello David;

I always presumed (not to say "assumed") that Siemens did not support Modbus/TCP. Your post made me look a little deeper, and here is what I found on different Siemens webpages:

Siemens websites on Modbus/TCP options:



You can obtain further information on this topic at the following address:
Siemens AG
Industrial Solutions & Services
Information Technology Plant Solutions
Werner-von-Siemens-Str. 60
D-91052 Erlangen
Tel.: +49 91 31 7-46111
Fax +49 91 31 7-44757
Internet: <>

If you are located in Amwerica, note that you might have trouble getting pricing and delivery info from your local rep; divisdion of certain Siemens markets and products may be strange to understand for us laymen. In that case you would need to deal directly with the European providers, possibly using a Simatic Card (prepaid buying cards used for certain transactions over the web).

Thanks for the new comm. oppertunities,
Daniel Chartier


Thanks for tracking that info down, it should help it trying to purchase this library. My Siemens Rep. said, "Since it's very pricey for one thing but also it's not readily available/supported here in the US." He went on to say there might be shareware versions meaning customers had made there own custom implementation of Modbus TCP. Its very feasible to write a custom protocol with FB50 and FB60. I was hoping someone else has been down this path and might have a working example to share. I really only need to implement a simple class 0 master or slave.


By Michael Griffin on 2 December, 2006 - 8:39 pm

If anyone some reason decides to write their own Modbus TCP implementation for the S7-300, Siemens wrote a Modbus RTU (not TCP) "driver" for the S7-200 in ladder (or possibly IL, I haven't looked at it) which they provide for free. This could be used as an implementation guide for the S7-300.

The Open Modbus/TCP you describe has a few problems. It uses the AG_SEND and AG_RECV Siemens blocks, which in turn use SFC58 and SFC59.

In any complete TCP/IP transaction, these limit the length of any transfered data to 240 bytes. (Some of the CPs are stated to transfer more, but they do this by splitting the data into 240 byte transactions).

Unfortunately Siemens do not seem to have implemented the IP protocol fragmentation scheme correctly, so each of these transactions will appear (to, for example, a Windows socket) as complete and separate.

The maximum data length of a Modbus RTU message is 255 bytes, and the Modbus TCP header adds a further 6 - i.e. greater than the 240 limit.

If you are sure that you will never have more than 240 characters (which is 234 if you exclude the ModbusTCP header) then you are probably OK. If you are not certain, then you should take further advice.


By John Barnet Engineering on 29 November, 2006 - 11:32 pm

The S7 300 will do Modbus TCP if you have the newest Ethernet card. It is very easy and the part number you listed is correct. When you purchase the package there are samples contained within the software.

You can also go to and search their FAQs for Modbus TCP and it will tell you everything you need to know and it has a manual you can download to tell you all the details.

Your Siemens rep can also get you more information or you can call their hotline and ask them.

It can be both master and slave.

By Nick Ford on 16 March, 2007 - 9:28 pm

I would appreciate a copy of your documentation for this...

Thanks and regards,

By Mohoch Megabar on 1 June, 2007 - 11:13 pm

Hello Richard,

I came across your message and thank god. I have a serious application where I need an existing S7-300 with a CPU 314 2DP to communicate with a set of 8 Schneider SEPAM Power relay set as Modbuse slaves 2 through 9. Could you kindly forward your documentation to my e-mail address at satel_ service @ yahoo. com, since my connection to the internet is so slow that I cannot download any reasonable size file?

Thank you in advance for all your kindness and best regards.

Mohoch Megabar

By Shahid Waqas on 29 November, 2006 - 10:48 pm

I do not think that Siemens does Modbus TCP, as far as I know. (Dont know of any latest developments - Siemens people: Any comment)

However, they do the Serial Modbus. You need CP341 (Serial) and Modbus software for either Master or Slave (as required). I have seen simplex connection, but not sure if it would do redundant modbus communication as well!
Best Regards,
*Shahid Waqas*

You can also make it easy for yourself and use a gateway. HMS has one that "translates" from Profibus to ModbusTCP.
for more info, go to:

If you have any technical questions, email:

Try to use CP315-2DP with a CP343-1 and the FB OPEN MODBUS / TCP driver ver 2.1 (2XV9 450-1MB00).

Please see my reply to Daniel's post above.

By Anonymous on 5 May, 2007 - 9:36 am

I went to the webpage and tried to find the S7 example mTCPRead project. I can't seem to find it. Can you provide a link?

By David Wisti on 14 March, 2008 - 1:31 am

Just to close the topic, I finally did find the links to the examples. Looks like a S7 can talk Modbus TCP as a client in these examples. Thanks Oleg!

dear sir.
Siemens S7 315-2PN/DP(profinet version) can support Modbus TCP protocol by OPEN IE way!
best regards.

zhonghua from shanghai yamato scale co.,limit <>

Yes, Siemens offer a software package 2XV9 450-1MB00 to connect it with the Modbus-tcp network.