Siemens S7 Connection

Siemens S7 Connection

Siemens S7 PLC Connection 

Introduction  

This report provides guidelines for establishing a connection to Siemens S7 PLCs, specifically focusing on the S1200 and S1500 models. To initiate a connection with the PLC, it is essential to verify and control access through the S7 connector, which communicates with the PLC via port 102.

Access Verification  

Before establishing a connection with the PLC, it is crucial to verify and control access using port 102 on the S7 connector. Once access is confirmed, specific information is required to establish a connection.

Connection Information  

  • PLC Address

  • Rack and Slot Information

 

 

Physical Connection  

Additionally, obtain the slot information where the PLC is physically connected.

 

IPI (Input Image): The Input Image represents the current state of all input signals connected to the PLC. It's a data structure where the status of inputs is stored. The IPI is updated by the IPU based on the signals received from input modules. The PLC's program logic typically references the IPI to make decisions and perform control tasks based on the external inputs.

In Siemens PLC programming, "EB" typically stands for "Input Byte". An Input Byte (EB) is a data type used to represent a group of digital inputs in the PLC's memory. It's a byte-sized memory location where each bit corresponds to a specific input channel.

When you refer to "Read/Write IPI (EB) from PLC," it likely means reading or writing to an Input Byte that represents the Input Image (IPI). The Input Image (IPI) represents the current state of all input signals connected to the PLC, stored in memory. By reading or writing to this memory location (Input Byte), you can access or modify the state of the inputs in the PLC program.

Here's a brief explanation of what each operation might entail:

Read IPI (EB) from PLC: This operation involves reading the current state of the Input Image (IPI), which is stored in an Input Byte (EB) in the PLC's memory. It allows you to retrieve the status of various input signals connected to the PLC.

Write IPI (EB) to PLC: This operation involves writing new values to the Input Byte (EB) that represents the Input Image (IPI) in the PLC's memory. By doing so, you can simulate or change the state of input signals within the PLC program.

These operations are commonly used in PLC programming to interface with input signals and make decisions or perform control tasks based on the state of the inputs.

 

IPU (Input Processing Unit): The Input Processing Unit is a hardware component responsible for processing incoming signals from various input modules. It interprets the signals received from the input modules and updates the Input Image accordingly. Essentially, the IPU serves as the interface between the physical inputs and the PLC's internal logic. It ensures that the PLC's program logic accurately reflects the state of the inputs connected to the system by continuously updating the Input Image.

In Siemens PLC programming, "AB" typically stands for "Analog Byte". An Analog Byte (AB) is a data type used to represent a group of analog inputs in the PLC's memory. It's a byte-sized memory location where each byte corresponds to an analog input channel.

When you refer to "Read/Write IPU (AB) from PLC," it likely means reading or writing to an Analog Byte that represents the Input Processing Unit (IPU). The Input Processing Unit (IPU) handles incoming signals from various input modules and updates the Input Image accordingly.

Here's a brief explanation of what each operation might entail:

Read IPU (AB) from PLC: This operation involves reading the current state of the Input Processing Unit (IPU), which is stored in an Analog Byte (AB) in the PLC's memory. It allows you to retrieve the status of various analog input signals processed by the PLC.

Write IPU (AB) to PLC: This operation involves writing new values to the Analog Byte (AB) that represents the Input Processing Unit (IPU) in the PLC's memory. By doing so, you can simulate or change the processing of analog input signals within the PLC program.

These operations are commonly used in PLC programming to interface with analog input signals and process them within the PLC's control logic.

 

Data Reading Configuration  

To read data from the PLC, it is necessary to configure input parameters based on the chosen function. Four functions are available for reading data from the PLC:

  1. Read/Write Data Block

  2. Read/Write Merkers (MB)

  3. Read/Write IPI (EB)

  4. Read/Write IPU (AB) (tested)

Read/Write Data Block  

For the Read/Write Data Block function, the following information is required:

  • Data Block Address

  • Byte Offset

  • Bit Offset

  • Data Type

Read/Write Merkers (MB), Read/Write IPI, Read/Write IPU (AB) (tested)  

For these functions, the following information is required:

  • Address

  • Bit Offset

  • Data Type

Data Access  

Once all necessary information is provided, data can be accessed at the specified address.

Data Address

 Address          

 Address

 JS Data Type 

 Description                                            

DB5,X0.1         

DB5.DBX0.1       

Boolean      

Bit 1 of byte 0 of DB 5                                

DB23,B1 or DB23,BYTE1

DB23.DBB1  

Number       

Byte 1 (0-255) of DB 23                                

DB100,C2 or DB100,CHAR2

DB100.DBB2

String       

Byte 2 of DB 100 as a Char                             

DB42,I3 or DB42,INT3

DB42.DBW3    

Number       

Signed 16-bit number at byte 3 of DB 42                

DB57,WORD4       

DB57.DBW4       

Number       

Unsigned 16-bit number at byte 4 of DB 57              

DB13,DI5 or DB13,DINT5

DB13.DBD5   

Number       

Signed 32-bit number at byte 5 of DB 13               

DB19,DW6 or DB19,DWORD6

DB19.DBD6

Number       

Unsigned 32-bit number at byte 6 of DB 19             

DB21,R7 or DB21,REAL7

DB21.DBD7   

Number       

Floating point 32-bit number at byte 7 of DB 21       

DB2,S7.10*        

-               

String       

String of length 10 starting at byte 7 of DB 2        

I1.0 or E1.0      

I1.0 or E1.0    

Boolean      

Bit 0 of byte 1 of input area                          

Q2.1 or A2.1      

Q2.1 or A2.1    

Boolean      

Bit 1 of byte 2 of output area                         

M3.2              

M3.2            

Boolean      

Bit 2 of byte 3 of memory area                         

IB4 or EB4        

IB4 or EB4      

Number       

Byte 4 (0 -255) of input area                         

QB5 or AB5        

QB5 or AB5      

Number       

Byte 5 (0 -255) of output area                        

MB6               

MB6             

Number       

Byte 6 (0 -255) of memory area                        

IC7 or EC7        

IB7 or EB7      

String       

Byte 7 of input area as a Char                         

QC8 or AC8        

QB8 or AB8      

String       

Byte 8 of output area as a Char                        

MC9               

MB9             

String       

Byte 9 of memory area as a Char                        

II10 or EI10      

IW10 or EW10    

Number       

Signed 16-bit number at byte 10 of input area         

QI12 or AI12      

QW12 or AW12    

Number       

Signed 16-bit number at byte 12 of output area        

MI14              

MW14            

Number       

Signed 16-bit number at byte 14 of memory area        

IW16 or EW16      

IW16 or EW16    

Number       

Unsigned 16-bit number at byte 16 of input area       

QW18 or AW18      

QW18 or AW18    

Number       

Unsigned 16-bit number at byte 18 of output area      

MW20              

MW20            

Number       

Unsigned 16-bit number at byte 20 of memory area       

IDI22 or EDI22    

ID22 or ED22    

Number       

Signed 32-bit number at byte 22 of input area         

QDI24 or ADI24    

QD24 or AD24    

Number       

Signed 32-bit number at byte 24 of output area        

MDI26             

MD26            

Number       

Signed 32-bit number at byte 26 of memory area        

ID28 or ED28      

ID28 or ED28    

Number       

Unsigned 32-bit number at byte 28 of input area       

QD30 or AD30      

QD30 or AD30    

Number       

Unsigned 32-bit number at byte 30 of output area      

MD32             

MD32            

Number        

Unsigned 32-bit number at byte 32 of memory area      

IR34 or ER34      

IR34 or ER34    

Number       

Floating point 32-bit number at byte 34 of input area

QR36 or AR36      

QR36 or AR36    

Number       

Floating point 32-bit number at byte 36 of output area

MR38             

MR38            

Number       

Floating point 32-bit number at byte 38 of memory area

DB1,DT0          

-               

Date**       

A timestamp in the DATE_AND_TIME format               

DB1,DTZ10        

-               

Date**       

A timestamp in the DATE_AND_TIME format, in UTC       

DB2,DTL2         

-               

Date**       

A timestamp in the DTL format                         

DB2,DTLZ12       

-               

Date**       

A timestamp in the DTL format, in UTC                 

DB57,RWORD4      

DB57.DBW4       

Number       

Unsigned 16-bit number at byte 4 of DB 57, Little-Endian

DB13,RDI5 or DB13,RDINT5

DB13.DBD5  

Number  

Signed 32-bit number at byte 5 of DB 13, Little-Endian

MRW20            

MW20            

Number       

Unsigned 16-bit number at byte 20 of memory area, Little-Endian

 

 

 Examples  

 

%DB5.DBW8

 

%DB5.DBD60 à Read DB Address:5 Offset: 60 Data Type: DINT

 

 

%DB1.DBD2 à Read DB Address: 1 Offset: 2 Data Type: DINT

 

 

 

Additional Configuration for Extended S7 Protocol  

The newer PLCs provide an "extended" version of the S7 Protocol, requiring additional configuration steps beyond the basic setup. Follow the steps below to ensure successful communication:

  1. Disable Optimized Block Access:

    • Navigate to the PLC configuration settings.

    • Locate the "Optimized Block Access" option for the DBs you intend to access.

    • Disable the "Optimized Block Access" for the relevant DBs. Refer to the provided image for guidance.

  1. Enable PUT/GET Access in Protection Section:

    • Access the CPU Properties in the PLC configuration.

    • In the "Protection" section, find the "Permit access with PUT/GET" checkbox.

    • Enable the "Permit access with PUT/GET" option. Refer to the provided image for guidance.

These additional configuration steps ensure compatibility with the extended S7 Protocol and enable seamless communication with the PLC.

 

 

 

https://github.com/robinson/gos7  

https://flows.nodered.org/node/node-red-contrib-s7  


    • Related Articles

    • Modbus

      Modpoll is a command line-based Modbus master simulator and test utility utilizing the FieldTalk™ Modbus driver. To check Modbus connection using modpoll: cd modpoll cd x86_64-linux-gnu/ ./modpoll -t 1 -a 50 -c 2 -r 4 -m tcp 192.168.110.128 Parameter ...
    • Modbus TCP

      Modbus TCP, a widely used communication protocol in industrial automation and control systems, is designed to establish a connection between a server device, typically possessing input/output (I/O) capabilities, and a client device, such as a ...
    • SMTP

      SMTP is a protocol used for sending email messages over the Internet. It is a client-server protocol, where a client program sends email messages to a server program, and the server program forwards the messages to their intended recipients. There ...
    • OPC UA

      Introduction OPC UA (OPC Unified Architecture) is a highly adaptable communication protocol and architectural framework designed for industrial automation and control systems. Its purpose is to provide a standardized and interoperable approach for ...
    • Time Series Databases

      Introduction to Time Series Databases Time series databases are specialized databases designed to handle large amounts of time-stamped data, making them ideal for applications that require high-speed data ingestion, complex querying, and efficient ...