Communication with S7-1200

Topics about the Software of Revolution Pi
Post Reply
AFChris
Posts: 1
Joined: 03 Aug 2018, 16:09

Communication with S7-1200

Post by AFChris »

Hello!
I have a RevolutionPI and i want to read data from a S7-1200 PLC.
From Pictory, i use virtual device REVPi7 but i'm not sure to set the editor value correctly.

Values are:

PLC IP: 192.9.200.206
Local_TSAP: 0 ????
Remote TSAP: 0 ????
Conn_Type: PG
PLC Rack: 0
PLC Slot: 1
PLC Type: S7

Extended Data:

ACtion ID: 1
Data Direction: Read
Memory Area: ? (I need to read integer value)
DB#: The DB where i wantg to read data is DB20
Start: 1 or 40001?
Number / Size: 1 or 2 if i want to use the first integer?
Device value : Input 1

i also tried to use Modbus Master.
The connection with PLC was OK but impossible to read any value because i cannot address a DB number using the Modbus Master.

Thank you for your help!
creighton
Posts: 9
Joined: 09 Jul 2019, 05:24

Re: Communication with S7-1200

Post by creighton »

Hi,

I am also trying to do the same. May I know are you able to receive the values from the PLC and read it by using the Modbus module?

I have already programmed the PLC s71200 and assigned a DB.

Can you show me an overview on how to configure the revpi 7 to establish a connection with the PLC?
I know we have to use profinet IRT right? I am stuck with its configuration now.

Hoping to receive some support from your side. Thank you.

Regards,
Creighton
MartynSudworth
Posts: 9
Joined: 14 Nov 2019, 09:18

Re: Communication with S7-1200

Post by MartynSudworth »

Did you get an answer to this?
If so, how do you do it?
User avatar
dirk
KUNBUS
Posts: 2174
Joined: 15 Dec 2016, 13:19

Re: Communication with S7-1200

Post by dirk »

Hello there, we are working on a tutorial for RevPi7 but this will take some time (weeks).Until this is ready here is a howto in German language:
https://revolution.kunbus.com/forum/vie ... 854&p=3924
MartynSudworth
Posts: 9
Joined: 14 Nov 2019, 09:18

Re: Communication with S7-1200

Post by MartynSudworth »

You set the following values in RevPi7
------------------------------------------------
MEM PLC_IP "192.168.0.99" (put the IP address of the S7-1200 PLC in here)
MEM Local_TSAP "0"
MEM Remote_TSAP "0" (while you may read that the TSAPs have to be unique, internally this is sorted out, so you can put 0 in for both TSAPs (you can use 0 always, even if you have multiple RevPi7s))
MEM Conn_Type "OP" (I haven't tried PG, but OP works for me)
MEM PLC_Rack_No "0" (this is going to be 0 for all S7-1200, S7-1500 and S7-300s, it is normally 0 for S7-400, but you can put a 2nd CPU in another rack)
MEM PLC_Slot_No "1" (this is going to be 1 for S7-1200, 0 for S7-1500, 2 for S7-300s, it is normally 2 or 3 for S7-400 but depends where you put the CPU, do NOT select the S7-400 Ethernet card slot!)
MEM PLC_Type "S7"
(Don't put any quotes in)

To make the comms work, you do *not* need a program running in the S7-1200 (you do if you use the Profinet GW card, but not for RevPi7).
Good Luck
MartynSudworth
Posts: 9
Joined: 14 Nov 2019, 09:18

Re: Communication with S7-1200

Post by MartynSudworth »

(continued..)
You also need to set extended data (right click on your RevPi7)

Setup a read or write (in data direction).
Choose your memory area (I'd recommend DBs)
Select your DB start address (eg 20 means DB20)
Set your start databyte (0 means DBB0)
Set your "number/size" - note that this is in BYTES (so 20 means you read 20 bytes which is 10 words, which is 5 double words)
Select your Device Value (tags are explained below)

Note the following
A Data Direction of "Read" means this
PLC--->RevPi7 (so the PLC is writing, the RevPi7 is reading and you will use "Input..." tags in the RevPi7)

A Data Direction of "Write" means this
RevPi7--->PLC (so the revPi7 is writing, the PLC is reading and you will use "Output..." tags in the RevPi7)

So if you had Data Direction=read, Memory area=DB, DB#=80, start=0, number=size=20, you'd be reading from the PLC DB80.DBB0 to DB80.DBB19, the values of which go to the "Input..." tags (which your RevPi should then read in your C++ or Python program).

And if you had Data Direction=write, Memory area=DB, DB#=81, start=100, number=size=20, your RevPi should be writing into "Output..." tags and then to the PLC into DB81.DBB100 to DB81.DBB119

These examples work for S7-1200 and S7-400 (I haven't tried other PLCs yet but I expect them to work the same).

Important - you must then do
File, save as Start Config"
and then
Reboot the RevPi (Sudo reboot)
(I guess if you can stop and start the RevPi7 service, this would work also, but I generally reboot after changing the "Start-Config")
User avatar
dirk
KUNBUS
Posts: 2174
Joined: 15 Dec 2016, 13:19

Re: Communication with S7-1200

Post by dirk »

Hi thank you for your patience. So to answer some questions about the usage of the RevPi7 Module you have to remember this points:
- The usage of this module is without support.
- The use of this RevPi7 module is limited to the non-optimized protocol from Siemens.
The option to switch a Siemens PLC configuration to non-optimized transfer must be possible.
This is not possible with i.e. S7-1200 and -1500
- This option to use this non-optimized prodocol from Siemens has to be activated

We are going to provide a simple tutorial here so thank you for your patience.
stevennoppe
Posts: 5
Joined: 12 Oct 2020, 14:35

Re: Communication with S7-1200

Post by stevennoppe »

any news on the tutorial yet?

I would like to use revpi7 and node-red to send data from the PLC to a SQL database

thanks
User avatar
dirk
KUNBUS
Posts: 2174
Joined: 15 Dec 2016, 13:19

Re: Communication with S7-1200

Post by dirk »

Hi have a look here.
Post Reply