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.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

what is a simple way to control a siemens s7 with cvi

hi!
i want to read/send data from/to a siemens s7. what is a simle way to do that? i use cvi!

my email: christian.hoch@prollirolli.de

thank you
0 Kudos
Message 1 of 8
(3,918 Views)
Well, the simplest way to communicate if the S7 has a rs232 port is to connect PC and PLC via a serial cable.

Depending on the software resident on the PLC, you'll have to develop in your software a series of functions meet the communications stadards and write the correct message to the PLC and read correclty PCL answers. Check with the PLC software developer to know the communications protocol to meet.

At the cost of some effort in coding and test, you have all you need in your system: CVI, a serial port and nothing else.

Hope this help
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 8
(3,918 Views)

Hello , 


Is there a way to communicate between Labwindows and siemens s7 1200(Read /Write ).I searched for Ni opc with Labwindows but i had no luck finding an answer .

By the way the communication is established via the internet(wireless communication).


Thanks in advance.

0 Kudos
Message 3 of 8
(3,364 Views)

hi!
i want to read/send data from/to a siemens s7. what is a simple way to do that? i use labwindows cvi!

 MAIL : mejdi.afamec@gmail.com

0 Kudos
Message 4 of 8
(2,189 Views)

A simple click and forget solution doesn't exist for this. There are several possible options however:

 

1) Using OPC in the Siemens PLC you can have it publish data to the network. Note you will need to have a licensed OPC option for your PLC to do that. Not sure if it comes standard nowadays but it used to be a paid option in the past.

In LabWindows/CVI you then can access OPC channels through SharedVariables or possibly their predecessor called DataSocket.

 

2) You could also use the Snap7 library. This is a complete implementation of the proprietary Ethernet protocol to read and write data blocks and registers of Siemens S7 PLCs.

 

1) is fairly easy to setup and also the CVI side shouldn't be to hard to program. 2) gives you full access to the entire PLC (which in itself can be a very bad thing) but requires you to tinker with the library and integrate it into your LabWindows/CVI program and do quite a bit of setup too as you will need to define what registers/addresses you want to access somehow, and hardcoding that in your source code is definitly not going to be a maintainable solution.

Rolf Kalbermatter
My Blog
Message 5 of 8
(2,138 Views)

I was to reply in a very similar way, with the addition of the possibility to use Modbus if the PLC comes equipped with it (it used to be a paid option too when looked at it a few years ago).

 

But I have to disagree with Rolf on the ease of use of the solutions proposed. I have tried to setup a OPC communications with a PLC and found myself lost in an infinite series of configuration options for security, tags and so on that I wasn't able to solve by myself, while I had a test application with Snap7 up and running from scratch in just a few hours. It is possible that a few days of education or study on OPC is enough to understand how it works, but this definitely isn't something that I consider easy or simple.

 

It's correct that with Snap7 you can have the whole PLC at your hand and this may be risky, but I normally don't develop the PLC side and limit myself to use what the Producer has published as an interface to his application (normally a bunch of registers and optionally some digital I/O) and I have found in this respect Snap7 library an easy and straightforward instrument to use with CVI.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 6 of 8
(2,133 Views)

OPC security can be a hassle, but at least there was some serious thought about security. The Siemens TCP protocol has nothing that you could call security beyond security through obscurity! 😀

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 8
(2,128 Views)

If there’s an example to better explain

0 Kudos
Message 8 of 8
(1,857 Views)