Programming an 315 2DP, connecting with an OPC server, Testing a c++ app!!

hlvas

Member
Join Date
Sep 2010
Location
Thessaloniki
Posts
4
To anyone that is interested to share his experience,

Hi, I program c++ for years, but in PLC areas I am completely unfamiliar, so please bear with me.

ok now to the task in hand. I have a c++ application that needs to be connected to an OPC client an get some data from a PLC through an OPC server.

what I have in my lab: I have a SIMATIC S7 SDK V5.3 + SP2 + HF1. I also installed the S7 lite, a CP5611 card, MPI cable and a SIEMENS 315 2DP CPU (only the CPU nothing else).

In oder to accomplish the task above I thought to make a test app to test the connectivity of all above items. So I am planning to use the SIMATIC OPC server and the OPC scout that comes with it. I am also planning to write a small program to the 315 that the only thing it does is changing some values, so I can verify that these values are correctly read from the OPC server and client.

What I have done so far: I have successfully connected with the 315 through the S7 lite SDK using MPI. I have also read the excellent document of Jesper M. Pedersen and I have set up the OPC server and the OPC scout from SIMATIC S7.

and now to the questions:
1. Basic PLC programming. How I can set and reset a couple of bytes in the PLC ( as I said I am totally unfamiliar, but willing to learn :) ). I want to use a counter so that after N seconds change some bytes to lets say 0 and 255 and then repeat.

2. What have to do to pass these values to the OPC server,so that OPC server can read these values regularly

3. What have to do to pass these values to the OPC scout so that these values are also passed to OPC scout.

4. Some general remarks about how connect a c++ app with the OPC scout.

You do not have to answer all of them :). Any comments hints references books, will be greatly appreciated.

Thanks
 
2. Nothing. Your app polls the data from the PLC.

3. Create a connection in the OPC scout. Then add Items (Adresses in the PLC) to the connection. That is all.

4. This site is probably the best: http://www.opcconnect.com/.
Apart from that, you app shall connect as an OPC client to the OPC Server.
The OPC Scout is an OPC test client. So it has nothing to do with your app.
 
Hi Jesper,

Thanks for your reply.

Two quick questions:
1. Shouldn't OPC scout be able to list the variables automatically. Do I have to add them manually (e.g. like Connections->\S7->@LocalSERVER->objects->DB->DB1->Define New Item). The reason I am asking this is because I have read a SIEMENS article http://support.automation.siemens.c...lib.csinfo&lang=en&objid=17413251&caller=view That OPC scout was able to list the variables in the \SYM directory, which in my case \SYM is listed with an X.

2. When you say add items (Addresses in the PLC) in which addresses are you referring?. For example in my case I have a variable (REAL) in my DB1 table that is in the address +2.0. Is this the address you are referring?

Regards,

Vasilis

PS. I am planning to write a small documents about all the issues, I faced during my understanding of PLCs, STEP 7, configuration.... Taking about the Chicken and the Egg here :).
 
1. In order to get the symbols from the STEP7 project, you have to have an integrated project with both S7 PLC and PC Station with OPC Server.
The connection from the OPC Server to the PLC must be fully specified.
And you must set the option "Use Symbols" in the setup of the OPC Server.

2. Yes, if you dont have the symbols, you have to add them by yourself. You can browse for the available addresses in the PLC. You will get a list of the DBs. But you have to specify the exact byte address and type yourself.
 
Hi Jesper,

I am in a deadlock here. I tried to follow your advice. What I am looking is to see the variables of my PLC program to OPC Scout.

I have set OPC server with S7 protocol.I have also successfully connected my 315-2DP with the CP5611 card as the image attached. I have also set OPC Server to "Use Symbols" to all (I tried to use the "Selected" button but the Use symbols in this case is empty which is a first indication that the Symbol table is empty).

I have compile the entire project without any errors. However still in my OPC Scout does not list any symbols.

Am I doing something wrong. Could it be a version problem?

Thanks a lot,

Vasilis

Setup.jpg
 

Similar Topics

Hello colleagues, Some time ago I started my adventure with programming. With your help and the courses, things are starting to come together...
Replies
13
Views
589
Dear All, I need a sample PLC program to count the output pulse of a mass flow meter so that a specific amount of mass (for example 100gm)can be...
Replies
2
Views
79
Hi Please I have zeilo smart relay #SR2A201BD but I don't have it's programming cable. Can I use any general usb/rs232 converter? Or need...
Replies
2
Views
78
Hi, Does anyone have thoughts or know of, can point in the right direction any published materials with a plumbing centric point of you explaining...
Replies
1
Views
125
In this sample programming, what does U4 mean? Any assistance would be greatly appreciated.
Replies
8
Views
169
Back
Top Bottom