Socket Communication Between S7 PLC and another PC Running VB Application

J

Thread Starter

jeet

According to the information I downloaded from the Siemens website and S7 help (Please refer to file "HELP Socket.doc").

I create my own VB program to open port 8101 and I successfully get connection from PLC (connection status 'established' display in NETPRO
when I online).
Then I tried using AG_LSEND and AG_LRECV from PLC. To send / received data from my VB application. It's never successful, even though both of the party display socket status "connection established" (Please refer to file "Socket Communication between VB and S7315.doc")

What I want to achieve is direct socket communication between PLC and Computer, please advise. I don't know whether I'm on the right track?

thanks

best regards
jeet
 
Hi,

1. Have you configured a connection in NetPro?.
2. For AG_LSEND/ AG_LRECV (long send/ long receive), you have to enable an option (Data > 240 byte) in the properties of ethernet card in HW-Config.

ck_chen
 
Hi!

I think it is better not to use the SEND and Receive Blocks for the communication.

Try to use Fetch / Write jobs to directly access the PLC memeory area and get or Write the Data.

I can send across the exact info oín a day or two.

I did the same with Delphi application on the PC and S7-400 PLC.
 
Hi!

Please refer the Section C of the following manual .This will give you an overview of the data structure to be implemented on the PC under VB

SIMATIC NET NCM for Industrial Ethernet
Edition: 11/2002 for NCM S7 V5.2 and higher
Order number of the manual: 6GK7080-1AA03-8BA0

You can also download the manual under the Entry ID 1172423 from the customer support site of Siemens.

In Step 7 under the network configuration , insert a new connection of type TCP. Partner details are not required.

Set the following under the Properties TCP Connection –

Addresses Tab - Write the Port Address for LOCAL and leave the two fields under PARTNER blank

Options Tab – select the mode as Fetch Passive

Repeat the same with one more connection with a different Port address and select mode as Write Passive in the options tab.

The active connection establishment should be set to "NO"

When the connection is established between the PC and PLC you should be able to see your PC’s IP address on the S7 NCM window.

Now use the format given in the Manual for accessing directly the memory area of the PLC by accessing the corresponding port declared in the Network configuration.

The whole idea is that for the S7 PLC it will be like direct memory access from a S5 PLC because of the header frame.

Good luck.
 
I get the status = established
but I don't get the IP address and not the port number.

??????????

/Alexander
 
P

Peter Harris

Hi
I am a bit of a PLC newbie, but communicating with a Siemens S7 via TCP sockets is exactly what I have to do for the project I am working on (a drain/fill line for a Whisky company).

I will be coding in Python, but since a socket is a socket in any language, I can take advice in the form of VB or whatever too.

What I would like most of all is some sample code, but even a link to a manual or a hint of where to start would do.

You can mail me anything (within reason) at peter dot harris at kyndal (a company in the UK).
 
I am student from India. Our project needs program in VB to display the values of data on excel sheet of the OFS software. If anybody has any idea about it plz mail me at [email protected] thank u for ur support.
 
Top