Assistance with Modbus TCP Implementation in TIA Portal

Sali

Member
Join Date
Feb 2024
Location
somewhere
Posts
23
Hi,
I have completed a program for an S7-1214 PLC in TIA Portal, and my client has requested Modbus TCP communication for alarm statuses and sensor readings. As I'm new to Modbus TCP, I would like some guidance.
I am using a Modbus server Function Block and utilizing holding registers of INT type. However, I need to understand how to incorporate BOOL data into these registers.

Is it possible to use the Modbus client FB instead of Modbus server FB for this?
 
The old names for for server/client was better to visualize how it works.
Slave = Server = Passive until polled by a client.
Master = Client = Controlling the communication, ie polls one or many servers.
 
The client FB is to read/write data from something else. Server lets someone else use your data. I think you just use different registers.
 
Can I use two holding registers for this? One for an INT data type and another for a BOOL data type?

If someone needs to read data from my PLC, should I use a MB Server Function Block in my program? How can I restrict read access only to clients?
 
Can I use two holding registers for this? One for an INT data type and another for a BOOL data type?
Yes, although you will have to put the values in those registers, and the client will have to know which is the INT value and which bits are the BOOLs in the other.
If someone needs to read data from my PLC, should I use a MB Server Function Block in my program?
Yes, the PLC would be the server responding to requests, and the "someone" would be the client.
How can I restrict read access only to clients?
I don't think you can do this with the the Modbus Server Function Block; one way to do it would to put the PLC behind a firewall.
 
I have attached a screenshot of my program. Can you check if this method of adding BOOL values to holding registers of INT type is correct?
 

Attachments

  • BOOL TO WORD.png
    BOOL TO WORD.png
    10.6 KB · Views: 24
If someone needs to read data from my PLC, should I use a MB Server Function Block in my program? How can I restrict read access only to clients?
Modbus is a very basic protocol. Easy to implement, simple, supported by tons of devices. It comes from an era long before cybersecurity was a concern. I'd recommend using something like OPC UA if you want to restrict access to the PLC. Most 1200s should support it out of the box, with new enough FW and new enough portal version.
 
I have attached a screenshot of my program. Can you check if this method of adding BOOL values to holding registers of INT type is correct?
Yes, you are writing the first bool of holding register 40001 and 40002. You can check that by using a Modbus pool/modbus scan targeting the IP address of your PLC and you will see something like this 1730814742070.png (I used different registers to show it, Hold_reg18 and 19, modscan offset+1).
 
Yes, you are writing the first bool of holding register 40001 and 40002. You can check that by using a Modbus pool/modbus scan targeting the IP address of your PLC and you will see something like this View attachment 73819 (I used different registers to show it, Hold_reg18 and 19, modscan offset+1).
I would like to understand how to use different types of holding registers. Do I need to use two separate Modbus server blocks (MB_SERVER) to implement this?
 
I would like to understand how to use different types of holding registers. Do I need to use two separate Modbus server blocks (MB_SERVER) to implement this?
What do you mean by "Different types"? You can use holding registers for many data types, you can use it for bools as you showed in previous post, you can use it for INT/WORD using full holding registers. I show you an example:
1730989058212.png
I use this to show flow transmitters and pressure transmitters. Just be careful of the +/-32767 integer limit. You can use two sequential holding registers to write a DINT value if necessary. No need to split modbus servers.
 
What do you mean by "Different types"? You can use holding registers for many data types, you can use it for bools as you showed in previous post, you can use it for INT/WORD using full holding registers. I show you an example:
View attachment 73878
I use this to show flow transmitters and pressure transmitters. Just be careful of the +/-32767 integer limit. You can use two sequential holding registers to write a DINT value if necessary. No need to split modbus servers.
Thank you for the clarification. I have now chosen the integer (INT) type for the registers and attached a screenshot showing how I map my data to the registers.

Additionally, is there any issue with using the CP-1243-1 module for Modbus TCP/IP? ( Ethernet port of my PLC is already connected to the HMI)
 

Attachments

  • Modbus_Mapping.png
    Modbus_Mapping.png
    16.6 KB · Views: 6
Last edited:
You can use the CP module without issue.

You can also add a switch in between, or utilize the switched port on the HMI (if it has one).
 
Hi,
I have completed a program for an S7-1214 PLC in TIA Portal, and my client has requested Modbus TCP communication for alarm statuses and sensor readings. As I'm new to Modbus TCP, I would like some guidance.
I am using a Modbus server Function Block and utilizing holding registers of INT type. However, I need to understand how to incorporate BOOL data into these registers.

Is it possible to use the Modbus client FB instead of Modbus server FB for this?
Additional Information About Modbus. You have to be careful about using Modbus Communication for "Mission Critical" applications, especially if you are using Modbus to read values from I/O devices.
 
Thank you for the clarification. I have now chosen the integer (INT) type for the registers and attached a screenshot showing how I map my data to the registers.

Additionally, is there any issue with using the CP-1243-1 module for Modbus TCP/IP? ( Ethernet port of my PLC is already connected to the HMI)
Yes, exactly as you did in the picture. Just an additional info, I saw you multiplied by 10 the value just like I did, the purpose is to show the first decimal value to the SCADA system reading the value. For example:
Water level is 1,5 meters = I write 15 on the holding register. The system accessing that data has to divide the value by 10 to get the correct value. Decimal would be lost otherwise. As I said before, just be careful of the +/-32767 integer limit. Sometimes is necessary to use two registers, it often happens with very large numbers measurement like power metering total energy delivered.
You can use the CP module without issue.

You can also add a switch in between, or utilize the switched port on the HMI (if it has one).
Yes, just like boneless said. I recommend using a switch as well, for maintenance purpose is very useful and you don't have to unplug other monitoring devices.
 
You can use the CP module without issue.

You can also add a switch in between, or utilize the switched port on the HMI (if it has one).
The HMI is SIMATIC HMI TP700 Comfort, which has one Ethernet port connected to an S7-1214 PLC. The second Ethernet port on the HMI is currently unused.

  1. Can I use this second Ethernet port for Modbus TCP communication? If so, what configuration steps are needed?
  2. Alternatively, is it possible to use an Ethernet switch instead of the CM 1243-1 module to enable Modbus TCP communication? If so, which Ethernet switch would be compatible, and how would I configure the system accordingly?"
 

Similar Topics

Hello guys, Just getting back to the ship after 3 months off and being flooded twice by tidal surge from hurricanes at my home. (Its been a rough...
Replies
1
Views
192
Hello, we have been tasked with finding a solution to add Modbus devices to an Ethernet IP network. Is there anyone that has experience with a...
Replies
13
Views
4,168
Hi, I am having issue when starting iFIX3.5 workspace as it is displaying iFIX INTERNAL ERROR and display a message saying " Networking has not...
Replies
3
Views
177
Good day! I am reaching out to request assistance with persistent issues I am experiencing in a TIA Portal V19 project, particularly following...
Replies
0
Views
165
hello community! please what is the best module to add in order to use industrual ethernet with siemens 1515-2PN
Replies
3
Views
294
Back
Top Bottom