LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW have free library to interface with SIEMENS PLC S7-1200?

LabVIEW have free library to interface with SIEMENS PLC S7-1200?

 

Best Regards,

Nirut

0 Kudos
Message 1 of 6
(14,830 Views)

NI provides drivers for their own hardware and they host drivers of different manufacturers on their Instrument Driver Network.  If you don't find it on IDNet (a quick search returned no results), you'll need to check with Siemens to see if they have written a driver package to interface with Labview.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 6
(14,782 Views)

Well, since a PLC is a Programmable Logic Controller, it all depends on how the PLC was programmed.  Is it set up to use Modbus?  Ethernet IP?  TCP?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 6
(14,768 Views)

There are various ways to interface to a Siemens PLC.

 

The easiest albeit not cheapest is probably OPC UA. You will need an OPC UA server on the Siemens PLC, which is usually an extra software block you need to buy and install. And on the LabVIEW side you need to OPC UA Client library, which I'm not sure about the price.

 

Another option is to make sure there is a Modbus, Ethernet IP, EtherCAT or ProfiNet interface on the PLC side. This can be a software block, or a dedicated hardware interface module. In the case of ProfiNet it often is standard on Siemens PLCs since it is the Siemens interconnection standard.

 

A less traveled route is to use the Siemens proprietary S7 network protocol. There are commercial libraries that support it, such as the Accon-AGLink software which comes in the form of a DLL, so will only work for Windows (they do have a Linux shared library but I never managed to get it running on one of the x86-64 based cRIOs) and needs to be interfaced to with Call Library Nodes.

 

Last but not least you have Snap7, an open source C driver which actually even has a LabVIEW wrapper for it. The C part is pretty cool, the LabVIEW wrapper part is however less than optimal in my fully biased opinion. This is a voluntary project and the protocol Siemens is using is mostly undocumented, so they had to reverse engineer everything. It only supports the old fixed location data elements from the earlier Step7 projects and not the newer "compacted" data elements that are standard used in the TIA type projects. In order for Snap7 to be able to read and write data blocks in the PLC you have to set in the Siemens project the according data block groups to not be compacted!

 

The Accon-AG Link software does not have that limit anymore. There you can read in a TIA project file and it will correctly generate the internal dynamic addresses needed to read and write the items over a new protocol extension that Siemens added.

 

That all said it is a consideration if you want to let external software have direct access to most internal registers in your PLC. With Accon-AGLink and Snap7 it is fairly easy to interrupt a PLC in very nasty ways by writing values in any of the PLC registers. That could be by malicious intent, negligence or simply a bug in your software.

 

The Siemens recommended way used to be to create a specific TCP software block in the PLC that supports a custom made TCP IP protocol and to interface to that from an external system. This allows much better control over who can connect to that protocol block and what can be communicated to and from the PLC to outside entities.

Rolf Kalbermatter
My Blog
Message 4 of 6
(14,758 Views)

"Version:1.0 StartHTML:000000271 EndHTML:000055619 StartFragment:000054658 EndFragment:000055442 StartSelection:000054658 EndSelection:000055442 SourceURL:https://forums.ni.com/t5/LabVIEW/LabVIEW-have-free-library-to-interface-with-SIEMENS-PLC-S7-1200/m-p... LabVIEW have free library to interface with SIEMENS PLC S7-1200? - Discussion Forums - National Instruments

Last but not least you have Snap7, an open source C driver which actually even has a LabVIEW wrapper for it. The C part is pretty cool, the LabVIEW wrapper part is however less than optimal in my fully biased opinion. This is a voluntary project and the protocol Siemens is using is mostly undocumented, so they had to reverse engineer everything. It only supports the old fixed location data elements from the earlier Step7 projects and not the newer "compacted" data elements that are standard used in the TIA type projects. In order for Snap7 to be able to read and write data blocks in the PLC you have to set in the Siemens project the according data block groups to not be compacted!"

 

Snap7 does looks interesting for me since it already has Labview wrappers included and I want communicate with S7 1200 PLC.

Since there is no datasheet for it...Is there any good forum discussion or reference about it somewhere?

I found this:

http://snap7.sourceforge.net/ 

but nothing specific using labview wrapper. For example, I opened wrapper for reading/writing to PLC datablock. Looks like this:image.png

Maybe somewhere reference to understand parameter passing? For example, I don't know how DB Number is defined? What does it mean, there to define this? At PLC side?

 

0 Kudos
Message 5 of 6
(14,428 Views)

The terms DB, the DB number and de offset into the DB are all Siemens specific meanings and if you do not know what to use there you need to talk to the PLC programmer who did your Siemens program and let him tell you what DB number and address you need to access to read or write an according program value.

Rolf Kalbermatter
My Blog
Message 6 of 6
(14,420 Views)