Technical Forum

SIMATIC S7-1500

Sample Program: Modbus TCP with S7-1500

Thread Starter: Pegaia   Started: 10/2/2013 12:24 PM   Replies: 18

« Previous thread Next thread »
12» Page 1 of 2 (19 items)
  10/2/2013, 12:24 PM
Joined 7/24/2008
Last visit: 9/19/2014
Posts: 2493
Rating:
Rated: Excellent [4.33 out of 5 / rated 439 time(s)]. (439) 
Users with special expertise supervising conferences
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 

Hi,

one of the innovations of the SP1 for STEP7 V12 (Released for Delivery at http://support.automation.siemens.com/WW/view/de/76276623) is the inclusion of new instructions, for MODUBS TCP communication with S7-1500.

Here there is a very simple sample project (not tested) to illustrate how it works.
In the follow post (from 09/06/2014) I post a second file (tested) with two very simple sample projects to illustrate how it works:

·         S7-1500 as MODBUS server with S7-1200 as MODBUS client
·         S7-1500 as MODBUS client with S7-1200 as MODBUS server


TIPs:

 ·         There is two ways to build a MODBUS TCP communication:

       • With configured connection (defined in Network View), and that uses a communication DB with structure TCON_Configured.

       • With programmed connections (defined directly in the communication definition DB), and that uses a communication DB with structure TCON_IP_v4.

A simple way to build a TCON_IPv4 DB is to place, in your program a block TSEND_C, and use the properties of the block to create and configure the DB. After that you can delete the TSEND_C call, the TSEND_C block and its respective instance DB and just uses the create connection DB to MODBUS TCP proposes.

You can create alternatively to create an usual DB and inside to create a variable with the data type TCON_IP_v4 (type this name directly to the data type field).When to configure this DB, take in account:

         o    As server, Active Established should be “False” and remote port should be “0”

o    As client, Active Established should be “Ture” and remote port should be set with the server port number

·         MB_DATA_PTR could has absolute or symbolic address:


         o    Absolute address (M area or S7-300/400 compatible DB’s) is designed for a pointer  (for example P#M0.0 byte 10). When used with DB’s, the DB could have any data type structure.

         o   
Symbolic address (optimized DB – default for S7-1500). In this case it is allowed array of word or integer data types.

Thanks to Mr TomEPE and Mr dajiru for this tip



=== Edited by Pegaia @ 6/9/2014 12:39 PM [GMT ] ===


=== Edited by Pegaia @ 6/9/2014 12:37 PM [GMT ] ===



Denilson Pegaia
Siemens Industry Sector
- Technical Support & Hotline -
Hotline – Atenção ao Cliente / Customer Care
Tel.: +55 11 3833-4040
E-Mail: atencao.cliente.ac.br@siemens.com

Top
Thank you for this post from:
  10/2/2013, 12:26 PM
Joined 7/24/2008
Last visit: 9/19/2014
Posts: 2493
Rating:
Rated: Excellent [4.33 out of 5 / rated 439 time(s)]. (439) 
Users with special expertise supervising conferences
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
... Configuration Printscreen

Denilson Pegaia
Siemens Industry Sector
- Technical Support & Hotline -
Hotline – Atenção ao Cliente / Customer Care
Tel.: +55 11 3833-4040
E-Mail: atencao.cliente.ac.br@siemens.com

Top
Thank you for this post from:
  10/28/2013, 10:12 AM
Joined 4/24/2009
Last visit: 9/19/2014
Posts: 2813
Rating:
Rated: Outstanding [3.63 out of 5 / rated 133 time(s)]. (133) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
New question splitted to modbus tcp/ip communication between a S7-1500 and M340 (Schneider)

Best regards
O_Moderator
Top
  12/13/2013, 12:44 PM
Joined 4/24/2009
Last visit: 9/19/2014
Posts: 2813
Rating:
Rated: Outstanding [3.63 out of 5 / rated 133 time(s)]. (133) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
New question splitted to
modbus tcp connection between a 1511 and a 1211
Best regards
O_Moderator



=== Edited by O_Moderator @ 12/13/2013 12:44 PM [GMT ] ===


Top
  2/17/2014, 11:47 AM
Joined 11/19/2013
Last visit: 6/23/2014
Posts: 353
Rating:
Rated: Excellent [5 out of 5 / rated 3 time(s)]. (3) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
new question is splittet to  where can I download tested TCP client program, using 1513-PN CPU

Best regards / viele Grüße
GrasserF
Top
  3/5/2014, 1:13 PM
Joined 3/2/2014
Last visit: 9/17/2014
Posts: 7
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Dear expert,
                 I checked your tested program with modbus client simulator.But it is not working.It shows 8383 errror.(Error reading or writing data or access outside the address area of MB_DATA_PTR.

The error can occur locally as well as with the instruction "MB_SERVER".).Please treat this urgent.Am expecting your prompt response.

Top
  3/6/2014, 1:05 PM
Joined 7/24/2008
Last visit: 9/19/2014
Posts: 2493
Rating:
Rated: Excellent [4.33 out of 5 / rated 439 time(s)]. (439) 
Users with special expertise supervising conferences
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Hi,

can you place a printscreen of the program online and the configuration of your modbus simulator?

Denilson Pegaia
Siemens Industry Sector
- Technical Support & Hotline -
Hotline – Atenção ao Cliente / Customer Care
Tel.: +55 11 3833-4040
E-Mail: atencao.cliente.ac.br@siemens.com
Top
  3/11/2014, 1:37 PM
Joined 11/19/2013
Last visit: 6/23/2014
Posts: 353
Rating:
Rated: Excellent [5 out of 5 / rated 3 time(s)]. (3) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
new question is splittet to  modbus tcp client, CPU 1513-1 PN

Best regards / viele Grüße
GrasserF
Top
  3/20/2014, 10:30 PM
Joined 2/19/2014
Last visit: 9/17/2014
Posts: 1
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Hi,

Thanks for sharing with us the Modbus TCP with S7-1500 sample, we tried it and it's working fine here, however it seems that the PLC as a Modbus Slave (or Server) accepts only one Modbus connection. Is it possible to handle multiple connections ? So the PLC can receive requests from multiple Modbus Cients.

Thanks,
Rafael

Industrial Automation / IT Systems Analyst
Top
  3/21/2014, 11:02 AM
Joined 7/24/2008
Last visit: 9/19/2014
Posts: 2493
Rating:
Rated: Excellent [4.33 out of 5 / rated 439 time(s)]. (439) 
Users with special expertise supervising conferences
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 

Hi,

you can have several Clients accessing a S7-1500 Modbus server, but each one should take a connection (i.e. a different port) and so, accessing a different MB_SERVER call.


Denilson Pegaia
Siemens Industry Sector
- Technical Support & Hotline -
Hotline – Atenção ao Cliente / Customer Care
Tel.: +55 11 3833-4040
E-Mail: atencao.cliente.ac.br@siemens.com
Top
12» Page 1 of 2 (19 items)
Actions