From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW can communicate to SIEMENS PLC S7 1200 through Profinet TCP

Dear All,

 

I could to establish a TCP connection between LabVIEW and the CPU 1215 through Profinet.

I had a problem in LabVIEW side, but by adding a block, the problem was solved.

 

Regards,

Ras

0 Kudos
Message 1 of 10
(9,139 Views)

I am trying to output a PC game controller data to a S7-1200 CPU via wireless ethernet and a 300ft umbilical for robotic control.  Clan you share your .vi or where you found the .vi you used?  I found an example from post "S7 PLC TCP/IP Protocol Reference Example" but am waiting on it to be converted from 8.6 to 8.5 to see if it will be of any help.  I have not used Labview in a long time.  If I can not get it working then my next attempt will be to go from PS3 controller to bluetooth to Arduino to Modbus RTU to converter to Profinet (not very clean).

 

-Phill

0 Kudos
Message 2 of 10
(9,000 Views)

I have the same task, namely to communicate to S7 1200 using LabVIEW 12. The modules are CPU 1215C, TC, RTD, AI 16 BIT.

 

Could you please provide some details on how to do it and which changes I have to introduce in the LV in order to read the modules out.

 

Thank in advance for any help,

Anton

0 Kudos
Message 3 of 10
(8,858 Views)

Hi Anton,

 

From what I know, you would need a PROFINET interface board to do that, since the protocol requires deterministic timing and on-board CPU power. Currently NI offer only one such module for cRIO, but only for Slave mode.

 

I would recommend you to repost this on the Industrial Communications board where the right NI specialists regularly monitor. You should get better response there.

 

Regards,

Yodha

NI Singapore

0 Kudos
Message 4 of 10
(8,836 Views)

Hi Yodha,

 

thank you for the answer.

 

Anton

0 Kudos
Message 5 of 10
(8,795 Views)

I realized a labview PC based HMI using MODBUS TCP communication.

You have to set a Modbus TCP Server in S7-1200, sharing a certain memory area, and then you can read and write it from Labview using a modbus library.

 

Bye,

Carlo.

0 Kudos
Message 6 of 10
(8,519 Views)

Hello frnds

             I have to interface siemens PLC s7-1200 through Profinet connection with Labview 2010.so please share your idea how to interface it?

Pragnesh

 

0 Kudos
Message 7 of 10
(7,974 Views)

Hi Pragnesh,

 

As I mentioned in my old post above, this question should be posted in the Industrial Communications board where the relevant NI specialists are, so you'll have better chance of a good answer.

 

Having said that, I'll try to help a bit from what I know (improving on my old post Smiley Wink ). Profinet requires deterministic timing and onboard CPU to run the protocol (see this post), hence we need a Profinet board and cannot simply use ethernet port to communicate in Profinet networks.

 

The kind of board you need depends on how you define interfacing with the S7-1200 controller:

 

- Case 1: A device programmed by LabVIEW acting as Profinet slave for the S7-1200

NI has CompactRIO Profinet Slave module which you can use in this case.

 

- Case 2: A LabVIEW-programmable board replacing the S7-1200 as Profinet IO Controller

Comsoft offers a Profinet IO Controller for this kind of case. You can contact them for more information on it.

 

- Case 3: LabVIEW in a programming device (laptop, etc) communicate directly to S7-1200 via Profinet

I don't think this is possible. There is a reference example for this but only for S7-300. Even then it was achieved by observing the protocol, not from an official reference.

 

Hope this helps.

 

-Yodha-

Message 8 of 10
(7,914 Views)

Can you share some details or documentation about your work. I need to implement the same without opc server.

Can you share screen shots of LV program

0 Kudos
Message 9 of 10
(2,814 Views)

First you have to give a lot more information. Those "me too" posts are about as useful as tooth ache.

 

How do you intend to connect to the Siemens PLC? Does it have to be integrated in the Profinet infrastructure? Or can you live with a simple TCP based connection that has no specific real-time characteristics? Or do you rather want to connect through an MPI or other serial link? Can you use OPC UA?

 

The reference example mentioned in the second last post basically is implementing the Siemens S7 TCP protocol, which is itself using the frame structure of the ISO on TCP (RFC 1006). As such it has absolutely no real-time support nor guarantees. But for monitoring specific variables in the PLC that the PLC programmer has prepared for monitoring and interaction purposes is possible if you are careful. You just have to be aware that IF you write to some variable to trigger an action in the PLC program you have no direct control about when that action is triggered. If you need to have some confirmation somehow you, need to prepare an additional handshake protocol somehow, for instance two extra handshake variables, one that the PLC can write and one that your program writes. This can quickly get involved as you may have to do this for every separate variable you want to write from your program, so think about this before you use it.

 

It's possible to implement the S7 ISO on TCP protocol directly with LabVIEW native TCP nodes, as was done in the reference example, but the entire protocol is rather involved and doing that really properly on LabVIEW level is a bit of a challenge. I did do that myself in the past but it is a lot of work.

 

There are also ready made libraries out there that go this route of implementing the protocol directly in LabVIEW.

https://www.ni.com/nl-nl/support/downloads/tools-network/download.sp7-toolkit-for-labview.html is one of them and while I haven't used it, I believe it to work. This library is completely implemented in native LabVIEW, so it has the additional benefit to work on any LabVIEW system, independent of the underlying OS, and yes that includes all LabVIEW real-time platforms such as cRIO and FlexRIO.

 

If you rather want to go cheap but are not afraid about getting your hands dirty, you can also look at the Snap7 project. It also provides ready made LabVIEW wrappers for its shared library. Since this is a shared library, you are limited to OSes that this has been compiled too, unless you want to compile the library yourself for your specific platform.

 

All these third party libraries using the proprietary Siemens S7 protocol do have the limit that they do not support the new compressed memory layout that is default since about TIA 13. This requires a much more involved extra layer to determine the actual IO address from a symbolic name. If for some reason you can't disable compression in your TIA project for the memory area you want to access from LabVIEW, you could try to use the Accon AG Link software. This can address symbolic elements in the PLC and is a shared library and you would need to create LabVIEW wrappers for this. Again since it is a shared library you can only use it on LabVIEW platforms for which Accon AG Link provides compiled libraries.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 10
(2,801 Views)