5/31/2012 2:44 PM | |
Joined: 2/16/2011 Last visit: 7/8/2024 Posts: 229 Rating:
|
Hello, I Found a "guide about TCP/IP connections between PC’s and PLC’s" fromRasmus Frederiksen. In the guide he explain how to comunicate via tcp/ip direct with a pc with sample codes to VB.net. Regards
AttachmentThe guide about TCPIP connections between PCs and Siemens PLCs.pdf (6526 Downloads) |
Gabriel de Oliveira |
|
This contribution was helpful to
21 thankful Users |
6/17/2012 7:47 PM | |
Posts: 12 Rating:
|
Great information you've got. Thanks for posting it. I've been looking for something like these. |
This contribution was helpful to
1 thankful Users |
12/17/2012 12:00 AM | |
Joined: 11/14/2010 Last visit: 9/20/2022 Posts: 52 Rating:
|
thanks Gabriel :) |
Ahmed Elsayed |
|
This contribution was helpful to
1 thankful Users |
5/16/2016 12:59 PM | |
Joined: 4/28/2015 Last visit: 2/7/2024 Posts: 10533 Rating:
|
Hello, if PC will be act as Server or Client depends to you, simply client will ask server for data, so f.ex. if you want monitor PLC, it's signals, analog values, save data to SQL table from your PC application, probably PLC will act as Server and your application as Client. In this system is also important who will initiate connection, so Client always initiate connection, Server is pasive-accept connections and answers to Client's requests. In your application create Socket and connect to Server (PLC). On both side you'll prepare some frames as you wish for Exchange data. But that not means that you cant send data from PLC to PC application, all depends as you define your system of handshake. In your PC application you have some read/write instructions to do that like on PLC. Update: also this can be helpful: https://msdn.microsoft.com/en-us/library/5w7b7x5f(v=vs.110).aspx Update2: look pls for some basics for TCP/IP communications, socket library. If you'll find SELECT command due OS versions, probably you'll think more why systems can be different on PC and PLC sides applications |
Last edited by: Duris_I at: 5/16/2016 1:01:19 PMLast edited by: Duris_I at: 5/16/2016 1:02:09 PMLast edited by: Duris_I at: 5/16/2016 1:06:07 PMLast edited by: Duris_I at: 5/16/2016 1:20:07 PMLast edited by: Duris_I at: 5/16/2016 3:01:40 PMWith best regards... |
|
This contribution was helpful to
1 thankful Users |
5/26/2016 11:20 AM | |
Posts: 6 Rating:
|
Thanks for the link and the help. It really explained things in a better sense. So now I am slightly wiser regarding the TCP procedures. If anyone else is trying to make sense of the PDF at the start of this thread - The way that the connection is set up is that the PC acts as a server (listens for incoming connections) and the PLC acts as a client (establishes a connection to an open port on a given IP). So when using the MS link I attached - one must configure the PC to be a async server. I set up the PLC program as illustrated in the PDF, except I used a push button to trigger the sending of data. When I open the TCP port on the server side (PC) I manage to make a connection. The PLC TCP block gives the status 0x7004. If I don't open the port on the server side then I don't get that status (I get 0x7001). However, when I send data I get the "busy" flag and "complete" flag but nothing shows up on the receiver side. I've attached my C# file if anyone has time to take a look at it. (Just note - it's currently a .txt because Siemens don't allow .cs files to be uploaded) The C# file allows one to configure either a client or server. The file is still a bit buggy - it sometimes throws random errors but continues to execute. I will upload a better one as I remove bugs. This file works fine for PC-PC connections. I haven't tried through a router. It also works fine using the local host 127.0.0.1. AttachmentProgram.txt (1155 Downloads) |
5/30/2016 11:22 AM | |
Posts: 6 Rating:
|
Hi all, Using the MS link and PDF do work. I was just foolish. I put "<eof>" in my PLC code as the end-of-file delimiter and the C# code was expecting "<EOF>". I didn't accommodate for my silliness with String handling in C#. So as a result, the connection existed and the data was correctly sent. But, I never displayed it because my C# program never knew what it was looking for. I did set up my DB's differently to the PDF. I've attached a PDF with my own setup. Please comment if you have some useful info. AttachmentTCP connection with PLC and PC.pdf (1917 Downloads) |
This contribution was helpful to
1 thankful Users |
Follow us on