web services - Access Siemens S7-1200 through C# Application -


i'm trying access siemens s7-1200 database set , read tags through c# executable run on windows. intention have desktop app can establish connection plc on wi-fi / ethernet. app allow user read data off device (and save in sql database or .csv, etc.) , send commands device (via setting tags , plc executes instruction).

siemens s7-1200 , s7-1500 devices host webserver allows users create websites , set / read data via that. i've got working successfully. intend bypass website , pull data directly device. instead of pulling data website.

i've looked @ following already:

along lot of siemens tutorials , manuals.

any ideas on how set connection in c# appreciated.

i have got work. please first read pdf in this siemens link. unfortunately, can't attach pdf's on stack overflow. implement c# code on this microsoft link. according pdf (not explicitly said), plc establishes connection , therefore acts client. pc opens port , therefore acts server.

when setting plc, refer attached images. configure necessary db tx , rx respectively. use tsend , trcv blocks tcp connections (as in pdf). ensure chosen tcp port exists between 2000 , 5000. siemens not support higher that. used port 4005.

configure transmitter such when press button coupled req bit, or set on clock high. please press f1 on actual block , read why these bits set way. db set follows: enter image description here

the rx db setup follows: enter image description here

do not connect plc through router! need set router "port forwarding". refer link one , link two more info on that.

tip #1: ensure end-of-file delimiter (eof) in c# application matches in plc code. or account variations of eof using string handling in c#. current eof evident in c# code , tx_db.

tip #2: remember clear siemens registers tx , rx. image below shows how tx. use "string move".

enter image description here

this not perfect or complete solution. work without need opc servers , extracting data webpages through ftp servers, json structures, etc.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -