Connect to Siemens S7 plc with C# and S7.Net

  Рет қаралды 157,384

Mesta Automation

Mesta Automation

Күн бұрын

Пікірлер: 113
@libnerrr
@libnerrr 8 жыл бұрын
Exactly what I've been looking for last few weeks! Thank you!
@shuvendudas2807
@shuvendudas2807 4 жыл бұрын
Hello Mesta Thanks for your video.Can you please tell me that how I can connect to "S7 200 smart" plc? Will it require tsap and what is the configuration for PLC?
@JustoDisla
@JustoDisla 4 жыл бұрын
Can s7 be used in real time production environment with Siemens controllers?
@rigoltee
@rigoltee 2 жыл бұрын
Hi, Thanks for the useful video, what software would you recommend to simulate the PLC device if we have no PLC to connect to?
@Mesta-automation
@Mesta-automation 2 жыл бұрын
I think the simulator of TIA Portal works. Or eventually just mock the driver altogheter. There is an example on "HMI with WPF part 3" where I use a DummyPlcService.
@zaweerzulkivly4405
@zaweerzulkivly4405 8 жыл бұрын
hi there, this is a very useful video for me. Currently I am doing TIA Openness, do you have any idea on it? The concept is still the same using Visual Studio and TIA Openness. I really hope i can contact you
@LorridoWelcome
@LorridoWelcome 8 жыл бұрын
Thanks for this tutorial, but when it comes to LReal and LInt how do you convert them to get the right value in c#?
@massiv0n
@massiv0n 3 жыл бұрын
Hey Buddy! can you help me? I'm trying to write and get the value to this address DB14.STRING6.20 and I can't do it. Is giving me the error WrongVariableFormat or something like that. Do you know KEPServer tool ? I can access, write and read to this address without problems. Do you know how I can make it ? Sometimes, the factory line production is giving me the batch number or another important stuff and this is important for me. Thanks!
@draqos
@draqos 4 жыл бұрын
Hey man, do you know any possibility for a PLC like S7-1200 to work as a TCP socket listener so any random IPs from the same subnet could connect at it ? (I am not thinking to MODBUS, just TCP only) - thanks!
@mohamedabdel-raouf3476
@mohamedabdel-raouf3476 6 жыл бұрын
Hello , Can you guild me to what i should do to read data continuously from PLC ?
@eduardoescobar5786
@eduardoescobar5786 Жыл бұрын
How do I assign the offset ?, e.g. 0.0, 0.1 that you have shown. It shows that I can't modify that value I am using tia 16
@rafaelbonatto9143
@rafaelbonatto9143 4 жыл бұрын
Thank you very much for the video. Is it possible to place NetTOPLCSIM inside the C # library?
@maxencecharbonnier708
@maxencecharbonnier708 5 жыл бұрын
Hello Thao, Do you remember what was your firmware? I can easily connect to my plc, but i can't read anything :( while i desactivitez optimized block, and all protections. Thank you
@nada2668
@nada2668 4 жыл бұрын
Thank you for watching the example I'm testing it now When using S7.Net, we ask if there is a license Should I buy and use it?
@manzarkazmi3658
@manzarkazmi3658 5 жыл бұрын
Thank you for the tutorial. My question is can we read the values without using datablocks in TIA portal? thank you
@adamlukacovic917
@adamlukacovic917 4 жыл бұрын
Hello, did u find an answer? Thank you
@JMMedinaDev
@JMMedinaDev 6 жыл бұрын
Ciao Michele, Can you pls tell me if the Dll packed on Nugets is the full Dll with no dependencies to other libraries? I am trying to build this in unity Game Engine and I want to be sure it havent more dependencies than his own Dll. I dont want to go Web Server way , its not professional.
@azdasheerkhader2120
@azdasheerkhader2120 3 жыл бұрын
Hello i need the port can help me ?
@NathanStorniolo
@NathanStorniolo 3 жыл бұрын
Hi, how can i connect a live chart, showing the present value?
@yasirhabibkhugiani
@yasirhabibkhugiani 8 жыл бұрын
thank for the video, it is helpful. I have a question, is there any way we can access the DBs dynamically from the PLC? like lets say we want to find out how many DBs are there in a PLC?
@Mesta-automation
@Mesta-automation 8 жыл бұрын
No, it doesn't support browsing the DB.
@PIDOtomasyon
@PIDOtomasyon 5 жыл бұрын
hi, can I syncr time of plc with c# ? Can you help me? urgent please.
@walterp7125
@walterp7125 4 жыл бұрын
But must to pay for this library ?
@shaileshbangale1395
@shaileshbangale1395 3 жыл бұрын
Can you provide same for Profibus driver? I want to communicate VB.net application with S7-300 with Profibus driver. Please help.
@lechklimczak3976
@lechklimczak3976 6 жыл бұрын
Thanks for this video. Function Read / Write Class is working perfectly on newest version TIA15. Regards
@earth2201
@earth2201 8 жыл бұрын
Thanks you so much! This tutorial is so useful!
@nguyenquocbao3812
@nguyenquocbao3812 5 жыл бұрын
I got 3 errors that I cant build Visual: CS0815 Cannot assign void to an implicitly-typed variable (LINE 17) CS1061 'Plc' does not contain a definition for 'LastErrorCode' and no extension method 'LastErrorCode' accepting a first argument of type 'Plc' could be found (LINE 20) CS1061 'Plc' does not contain a definition for 'LastErrorString' and no extension method 'LastErrorString' accepting a first argument of type 'Plc' could be found (LINE 20) Can you help ?
@fcibe1
@fcibe1 3 жыл бұрын
Very interesting video, hi, I'm using this library, unfortunately I haven't found a way to use the events on datachange, can you help me? thank you
@Matt-bf4wp
@Matt-bf4wp 4 жыл бұрын
Ciao, funziona anche con s7 300 usato col vecchio simatic manager?
@jurajschmidt5254
@jurajschmidt5254 6 жыл бұрын
Is it compatible with different PLC, (B&R, Mitsubishi)?
@kenhthoinontre1628
@kenhthoinontre1628 8 жыл бұрын
WHICH VERSION TIA PORTAL DO YOU USE IN THIS VIDEO??? I USE TIA PORTAL V13 STEP 7 PROFESSIONAL BUT CAN NOT OPEN YOUR FILE
@michelecattafesta9122
@michelecattafesta9122 8 жыл бұрын
Tia V13 SP1. Unzip in a folder then on Tia portal: Project -> Open
@leonesmoura8756
@leonesmoura8756 3 жыл бұрын
It's possible conexion in C++?
@mattiapavoni6635
@mattiapavoni6635 7 жыл бұрын
Hi, there is a possibility that after some time without closing the connection with the plc the read class read some strange value? Like 2.xxxE-38 instead of 170666 for a double variable. if i have a service, it's better to keep connection always open or close it and reopen after some times? Thanks.
@Mesta-automation
@Mesta-automation 7 жыл бұрын
It shouldn't happen. Do you check LastErrorCode and/or LastErrorString after every read, before using the values? Usually with TCP sockets it's normal to keep the socket open and check from time to time if the connection is still alive. You probably need to investigate more, if this happens only with the double or also if other values are corrupted. Also try to replace ReadClass with a ReadBytes and assign the values manually, to check if it is an issue of the ReadClass method.
@mattiapavoni6635
@mattiapavoni6635 8 жыл бұрын
Hello, if i want to use the method ReadClass with a dataBlock bigger than 200 Bytes, how can i do it? I must create 2 different classes? Thanks!
@Mesta-automation
@Mesta-automation 8 жыл бұрын
+Mattia Pavoni it should work also for more than 200 bytes. The comment is outdated.
@mattiapavoni6635
@mattiapavoni6635 8 жыл бұрын
Ok, thanks. Sorry but i have some other question. If i want to use ReadClass, i have to use the same name for the variable inside the PLC and inside the class? if i have to read a block of byte representing a string how can i do that? i try declaring an array of bytes but it doesn't work... Thank you very much!
@Mesta-automation
@Mesta-automation 8 жыл бұрын
Strings are not supported in ReadClass at the moment, but you can download the sources and contribute to the project. Regarding the names, it's not needed that the names in the class are the same as the names of the DB. The order and variable type in C# must be the same of the DB.
@nitinmajgaonkar3060
@nitinmajgaonkar3060 2 жыл бұрын
What is the difference between S7.net Library & Snap7 library ? Thank you in advance
@matejhlaca1152
@matejhlaca1152 4 жыл бұрын
Helo..how you convert byte (inside is data in hex) to decimal?
@TheObstkuchen1
@TheObstkuchen1 6 жыл бұрын
thank you very much for this awesome tutorial.
@waqarhissam3331
@waqarhissam3331 7 жыл бұрын
Hi, I have downloaded the TIA Portal Step 7 Professional version V13 from Siemens offical website. During installation it is giving errror that file "SIMATIC_STEP_7_Professional_V13.001 is not found" even the file is existing in the same dierectory where it is looking for it. Please recommend me some solution for it.
@Mesta-automation
@Mesta-automation 7 жыл бұрын
I still have to convert the project...
@shelkadimka
@shelkadimka 5 жыл бұрын
Thank a lot !! But in v 0.4.0 has no error processing(var result = plc.Open();), plc. Open return void and has no lasterrorcode .....
@rodtaylor6585
@rodtaylor6585 8 жыл бұрын
Brilliant video! Thank you for posting it!!
@lukaaEverything
@lukaaEverything 6 жыл бұрын
Hello I can not read the M1000.0 bit marker. MD1004 read well System.InvalidCastException: "The specified cast is invalid." Thank you
@HaiPham-pv5lp
@HaiPham-pv5lp 5 жыл бұрын
I got an error : System.InvalidCastException: 'Specified cast is not valid.' Can you help me to fix it. Thank you.!
@jalmarihuitsikko7211
@jalmarihuitsikko7211 7 жыл бұрын
I tried this code on visual studio 2017 But I keep getting "System.InvalidCastException" on a row that reads variable from plc. When I open example project it doesn't throw same exception. What could be a problem? I did get and install the .dll from nuget.
@jalmarihuitsikko7211
@jalmarihuitsikko7211 7 жыл бұрын
I'd like to add that command like IsConnected() seems to work just fine there's some kind of problem I don't understand yet with commands that read variables.
@nqaiser
@nqaiser 6 жыл бұрын
hello, Thanks For a great tuturial, Can you confirm if this library will work for PCS7 system (Siemens s7 4105h plcs) Thanks.
@captfcknut
@captfcknut 7 жыл бұрын
Can you tell me why you only use DBXX addresses instead of usong the native addresses of the PLC, such as %Q, %I, %QW, %IW? Thanks!
@Mesta-automation
@Mesta-automation 7 жыл бұрын
I always mapped I/O to DB.
@PsykeBr
@PsykeBr 8 жыл бұрын
Hello! Nice work! Is possible to use that code with advanced HMI controls? Thx!
@Mesta-automation
@Mesta-automation 8 жыл бұрын
You can use them togheter. The easiest and safest way is to write the "Value" property of the HMI controls from the code. You can also implement the interface ICommComponent, that permits to assign a Tag to a control and the control gets the value by polling the plc. Personally I would go with the first approach.
@PsykeBr
@PsykeBr 8 жыл бұрын
+Mesta Automation Could you provide an exemple? That would help me a lot! Thanks again!
@Mesta-automation
@Mesta-automation 8 жыл бұрын
I'll see if I can do that this weekend.
@pell5589
@pell5589 7 жыл бұрын
I can't read A SINGLE VARIABLE bool type of both DBx... and Qx.y. please help me...thanks so much
@KeshavKumar20
@KeshavKumar20 8 жыл бұрын
Hi, I'm not using PLCSIM. How can I read the DBs by using this program if PLC is connected directly?
@kenhthoinontre1628
@kenhthoinontre1628 8 жыл бұрын
HI am the same you too . if you have the anwer .please let me know. thanks. and when you connect if you not clear it yet , you can communication with me my email: hoangtung2205@gmail.com
@KeshavKumar20
@KeshavKumar20 8 жыл бұрын
Hi, I got the solution but I have not tried it yet. We should use Sharp7 library instead of S7.Net.
@kenhthoinontre1628
@kenhthoinontre1628 8 жыл бұрын
Keshav Kumar hi I am not understand yet .about yours talking . I have real pleasure S7-1200 .type 1212c .V3 now I want make 1 project to practice.
@kenhthoinontre1628
@kenhthoinontre1628 8 жыл бұрын
but I have no idea .
@KeshavKumar20
@KeshavKumar20 8 жыл бұрын
Do you want to connect your PLC using C#? Use Sharp7 library. Do not use S7.Net. www.mesta-automation.com/how-to-write-a-siemens-s7-plc-driver-with-c-and-sharp7/
@alideniz2326
@alideniz2326 4 жыл бұрын
thanks a lot . thank you for posting project.
@PIDOtomasyon
@PIDOtomasyon 5 жыл бұрын
hi, I cant read and write strings, can you show please.
@mustafayurtseveri84
@mustafayurtseveri84 11 ай бұрын
The best tutorial. thanks
@gabrcatt
@gabrcatt 4 жыл бұрын
it's appearing error: "Couldn't establish the connection to 127.0.0.1. Message: WrongNumberReceivedBytes" What is wrong?
@НиколайТорощин-е6э
@НиколайТорощин-е6э 4 жыл бұрын
this library has an error in the file PLCAddress.cs Row 164. you need to fix VarType.Byte to VarType.Bit
@luslus..19
@luslus..19 8 жыл бұрын
Very nice video, thanks for sharing. Is it easy to create an HMI on C# with Siemens Logo ?
@Mesta-automation
@Mesta-automation 8 жыл бұрын
I recently wrote an article on another C# driver that should be compatible with Logo: www.mesta-automation.com/how-to-write-a-siemens-s7-plc-driver-with-c-and-sharp7/ You can check that out.
@luslus..19
@luslus..19 8 жыл бұрын
Hello Mestz Automation, The procedure that you did for the S7-1200 is the same for a Logo ? I am installing the package S7.Net will try it and will give you a feed back Thanks
@luslus..19
@luslus..19 8 жыл бұрын
The only issue will be with write and read variables because DBs does not exists in logo you have only Input,Outputs, M and NetworkVariable !!!
@Mesta-automation
@Mesta-automation 8 жыл бұрын
I don't know much about logo plc. You can download the sources from Github and make it work anyway.
@hoanghuynhminh9056
@hoanghuynhminh9056 5 жыл бұрын
Can you tell me when i use DBW, DBX, and DBD please ? Thank you so much
@reverz3
@reverz3 5 жыл бұрын
DBX is a bool, DBW a word and DBD a double word
@libnerrr
@libnerrr 7 жыл бұрын
I find ReadClass(); very unstable. Its necessary to keep class properties in order but making any action with class can affect it. According to MSDN " GetProperties(); method does not return fields in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which fields are returned, because that order varies. I consider creating an array with names and addressed of variables from plc and looping through to make many single Read();
@libnerrr
@libnerrr 7 жыл бұрын
I found a better solution. You can create two the same classes. Use ReadClass(); only with one of them and process only the copy.
@Mesta-automation
@Mesta-automation 7 жыл бұрын
I agree that ReadClass it's not the best implementation possible. The point of ReadClass is just to match the same exact structure of a DB in a class, so it can be filled with the data from the plc with a single instruction. Of course if you change the order of variables, in the program or in the plc, it will break. It is more fragile than indexing and convert manually all the data, but it saves you a lot of code.
@ucanhnguyen1134
@ucanhnguyen1134 4 жыл бұрын
in reality. We have to update data every mms, how can I do that?
@faressalah2672
@faressalah2672 7 жыл бұрын
can we use it withe S7-200 ??
@Mesta-automation
@Mesta-automation 7 жыл бұрын
+fares salah no but there is another tutorial in this channel that uses Sharp7, which will work with S7 200
@faressalah2672
@faressalah2672 7 жыл бұрын
can you give the link of video ? and thanks
@wuchris5242
@wuchris5242 Жыл бұрын
why readbytes function use 38 bytes?? i'm sorry not understand clearly
@vuminhtien5331
@vuminhtien5331 6 жыл бұрын
I can't connect to my real PLC (1212c dc/dc/dc), can someone help me? please
@loita6112
@loita6112 7 жыл бұрын
I can't connect to PLCSIM.Could you tell me why,please!!
@Souldk86
@Souldk86 6 жыл бұрын
try checking your PG/PC interface, windows "control panel" - switch to small icon, and then "set pg/pc interface" (or similar), the s7 online has to be connected to the PLCsim, for running af simulated PLC, or the network card a real PLC is connected to, if you have one a real one
@99westi
@99westi 3 жыл бұрын
Great work
@loita6112
@loita6112 7 жыл бұрын
i can't fine S7.net.dll
@asphalt_therapy
@asphalt_therapy 8 жыл бұрын
Best vid ever
@MarioCrispino
@MarioCrispino 3 жыл бұрын
Interesting video.
@simonedallai48
@simonedallai48 7 жыл бұрын
ciao michele sei italiano? avrei diverse domande da farti?
@Mesta-automation
@Mesta-automation 7 жыл бұрын
Ciao, si sono italiano.
@simonedallai48
@simonedallai48 7 жыл бұрын
Già da tempo programmo in plc e hmi siemens ma a dire il vero sono molto attratto da queste interfacce! Ora la domanda è usando visual studio come interfaccia posso andare a modificare le Db del plc? Mi consiglieresti più vstudio o visual basic da imparare? Grazie
@Mesta-automation
@Mesta-automation 7 жыл бұрын
Puoi leggere o scrivere sulle DB, non puoi aggiungere/rimuovere variabili, perche' ci sarebbe da compilare e trasferire il software sul plc. Visual Basic e' dal 2008 che non e' piu' mantenuto da Microsoft. La scelta sta su C# e VB.Net, entrambi in Visual Studio. Tutto lo sviluppo e le novita' di Microsoft sono in C#. VB.Net e' mantenuto solo per motivi storici e per la user-base, comunque molto ridotta, e ha valore 0 sul mercato. Il 99% dei nuovi software in .Net usano C#, come tutte le librerie open source.
@JMMedinaDev
@JMMedinaDev 6 жыл бұрын
You can only use S7.net and Sharp 7 in C#7 or higher, I have been working around with unity for weeks by now to just notice you simply cant, till unity dont support C# 7. I hope it goes to everyone whom is trying the same. Its simply pointless, tuplas are not supported in unity C# right now and both libraries use it. I just feel I wasted my time :( Gonna turn to try to sniffer the web server from Unity and see how it goes. Give visibility to that, will safe ppl time.
@nobleparti
@nobleparti 7 жыл бұрын
can u send visual studio C # software link free ware and key? ur video is very helpfull me
@Mesta-automation
@Mesta-automation 7 жыл бұрын
Visual Studio 2017 Community is free. Search it on google.
@MrPowerm
@MrPowerm 4 жыл бұрын
Danke für die Infos :D
@TheAdlcn
@TheAdlcn Жыл бұрын
Very very well
@lexobsm
@lexobsm 4 жыл бұрын
the only command working on this package is : isconnected, isavailable, open() ..... the others no !!!! not usefull really, try to work with a real PLC !!
@caubehinhbong
@caubehinhbong 6 жыл бұрын
thank a lot
@imran271981
@imran271981 8 жыл бұрын
please send your email
@Josempe1
@Josempe1 3 жыл бұрын
Can I use S7.Net with STEP 7? I have a s7400.
@matejhlaca1152
@matejhlaca1152 4 жыл бұрын
Also..how to pass the string? does the program know that first byte is total lengh and second the actual lenght?
@matejhlaca1152
@matejhlaca1152 4 жыл бұрын
Already solved this...if it will help somebody string Koda = S7.Net.Types.String.FromByteArray(db4Bytes.Skip(6).Take(40).ToArray()); Koda = Koda.Replace("\0", string.Empty); //remove blank positions from stirng
@lamsonlemai6516
@lamsonlemai6516 4 жыл бұрын
@@matejhlaca1152 hi matej, can you explain for details ? FromByteArray with its contructors ?
@lamsonlemai6516
@lamsonlemai6516 4 жыл бұрын
@@matejhlaca1152 thanks, I've just solved it.
How to connect to Siemens S7 plc with C# and Sharp7 library
24:19
Mesta Automation
Рет қаралды 63 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 58 МЛН
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 21 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
.NET and C# are in trouble. Here is what I'd do.
10:57
Ed Andersen
Рет қаралды 114 М.
S7-1200 Data logging Siemens PLC
18:08
Ali Al-Mukhtar
Рет қаралды 214 М.
C# and Siemens PLC lesson 1 - Read data from PLC
11:42
PLCFocus
Рет қаралды 22 М.
ציפור, מטוס או רחפן על סטרואידים? תעלומת הרחפנים המסתוריים בשמי ניו ג'רזי
2:52
כאן | חדשות - תאגיד השידור הישראלי
Рет қаралды 10 М.
Google unveils 'mind-boggling' quantum computing chip | BBC News
5:53
Demo: Siemens S7-1500 Dashboards made easy with View of Things (VOT)
30:36
Insights In Automation
Рет қаралды 7 М.
How to connect a Siemens S7 1200 PLC to a SQL Server Database
14:56
SQL4automation
Рет қаралды 77 М.
Forget Controllers and Minimal APIs in .NET!
14:07
Nick Chapsas
Рет қаралды 78 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 58 МЛН