Schreiben von Werten in SPS mit DotNetSiemensPLCToolBox

SoerenChrist

Level-1
Beiträge
2
Reaktionspunkte
0
Zuviel Werbung?
-> Hier kostenlos registrieren
Hallo zusammen,

ich versuche aktuell eine einfache Stuerungssoftware für eine 1200er SPS in C# zu programmieren. Dazu bin ich auf die Library DotNetSiemensPLCToolBox gestoßen. Mit Hilfe dieser Library hat es auch schon wunderbar geklappt, Variablen aus der SPS auszulesen. Bisher bin ich allerdings beim beschreiben von Werten gescheitert. Ich habe auch schon andere Forenbeiträge zu diesem Thema gelesen und die Besipielprojekte auf github dazu durchstöbert aber verstehe nicht was ich falsch mache.

Hier der besipielhafte Code:
Code:
if (_connection != null && _connection.Connected) {
    [COLOR=#445588]var[/COLOR] tag = new PLCTag("%DB300.DBW8", TagDataType.Int);
    tag.ControlValue = 5;
    tag.WriteValue(tag);
}

Kann mir hier jemand helfen?
Vielen Dank im voraus für eure Hilfe.

Gruß
Sören
 
Zuviel Werbung?
-> Hier kostenlos registrieren
Ich auch nicht, sieht richtig aus. Kann man in der HW COnfig den Für Put/Get vlt. auch das schreiben sperren?

In der Config war PUT/GET tatsächlich nicht aktiviert... Nur komisch dass ich dennoch lesen konnte.

Danke für deine schnelle Antwort, jetzt funktioniert es.
 
Hi, first off all i'm sorry for not writing German. (I'm not that good at it)

I'm trying to connect to a PLC/CPU by routing, but I can't find how to do it.

This is my setup:
PC connects through VPN to an Ewon which is connected to the PLC/CPU by Profibus.

Industrial Ethernet subnet: 000A-0007 (Connects PG to Ewon)
IP Ewon: 192.168.0.1
IP PG: 192.168.0.2

Profibus DP subnet: 0003-000B (Connects Ewon to CPU)
Profibus DP address CPU (315-2DP / rack 0 / slot 2): 4
Profibus DP address Ewon: 12


If anyone could give me an example on how to do this, or some more info so I can find it out myself, it would be very appreciated !!
 
Hi,

I´m not familiar with those Ewon routers, but it sounds to me, that the router provides an S7 connection to the plc, like when you connect your PG over Profibus to the PLC. If you try to connect with your programm over TCP/IP it can´t work. But I´m not shure if the Ewon can work like a TCP/IP CP to the plc.
Just an idee. :)
 
Zurück
Oben