Send data to Siemens PLC from a VB.NET application

Join Date
Aug 2005
Location
Hellerup
Posts
4
Hi,

Does anyone have an examble on how to connect to the plc (CPU 317-2) through a ethernet connection (CP 343-1)from a VB.NET application.

I would very much like exambles where the "Active connection partner" is set to Yes and No. Where the application sends 10 bytes to the PLC and where the application receives 10 bytes from the PLC.

Thanks,

Michael.
 
Opc

Do you have the S7 OPC driver ?

If yes then:
First try to get everything in OPC Scout, configuration of your OPC connection.

If you get your data there, then try something like this example first (reading an analogue input at PIW288):

Option Explicit

Dim objServer As OPCServer
Dim objGroup As OPCGroup
Dim objitem As OPCItem

Private Sub Form_Load()
Set objServer = New OPCServer
Call objServer.Connect("OPC.SimaticNET")
Set objGroup = objServer.OPCGroups.Add("Test")
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set objServer.OPCGroups.RemoveAll
Set objGroup = Nothing
Call objServer.Disconnect
Set objGroup = Nothing
End Sub

Private Sub tmrUpdate_Timer()
Set objItem = objGroup.OPCItems.Additem("S7:[S7 connection_1]PIINT288,1", 1)
Call objItem.Read(OPCDevice)
txtwaarde.Text = objItem.Value
End Sub



Please give some more info and I will try to help
Hi,

Does anyone have an examble on how to connect to the plc (CPU 317-2) through a ethernet connection (CP 343-1)from a VB.NET application.

I would very much like exambles where the "Active connection partner" is set to Yes and No. Where the application sends 10 bytes to the PLC and where the application receives 10 bytes from the PLC.

Thanks,

Michael.
 
The "Active connection partner" is dertermin if the PLC has to act as CLIENT(Yes) or SERVER(No), if I remember correct.
Then you set up a TCP connection, where you needs IP addresses and Port number for both ends.
In the PLC program you need to use FC5 and FC6, where you need the connection number, this is normally 1 for the first coinnection. And the IO address from the Hardware config.
In you VB.Net, or Delphi, or C++, and so on, you need to use modules for sending and receiving TCP datagrams.
 
Hej Michael.

In the downloads section you can find this example of "native TCP/IP" to S7:
http://www.plcs.net/downloads/index...e&filename=SendRecvDemo.ZIP&directory=Siemens&
I have no idea if it is any good.

Alternatives:

Libnodave on Sourceforge (open source freeware).

Simatic Net as OPC Server + OPC in VB. There are OPC wrappers that makes this much easier to implement.

Simatic Prodave.

Deltalogic AGLink (3000 Euro for unlimited use by one developer)
 
I am using a TCP communication on CP343-1 card, on every machine, we make, where we send and receive data amounts up to 4k.
However we only supply the PLC end. This is working very well, as long as you uses Fix length.
We do have at test application writen i delphi, but I do not have the scource code.
 

Similar Topics

Hello, I am sending data from a siemens 319-3PN/DP Plc with a Additional Cp343-1 card from the Plc to a remote BNR pc. I have configured 2 tcp...
Replies
7
Views
2,166
I am working on a project, inside an AB CLX, I implemented the Modbus TCP Client AOI published on AB website, to interreact with a Modbus ASCII...
Replies
7
Views
3,586
Hello friends We communicate between Micro 830 and a card that control DC motor via modbus RTU. We do not have any problems in communication. But...
Replies
1
Views
1,525
Hi guys, I'm moving on in my training and my next goal is to learn how to make my hmi and plc communicate. I have an idea of how it should be set...
Replies
3
Views
1,762
I'm fairly new to the PLC world. We are adding a pc to a line at my work the pc is to track good/bad parts and up/down time of the machine maybe...
Replies
8
Views
2,478
Back
Top Bottom