Jump to content

VB and Siemens S300


Guest Victor Martinez

Recommended Posts

Guest Victor Martinez
Posted
I'm a student who has to develop an application whith VB to display variables and send data to a DataBase. I've the PLC-PC connection done, using an s7 connection. I've some Siemens samples about this. Based in them, I've programmed some code just to display one or two items, but it doesn't work. There is an error related to reading the data. I think I've something wrong where I read it, but I don't know what. Please, could someone help me? The code I have, and where the error is, is: ItemObj.Read(11, myValue, myQuality, myTimeStamp) 'Lectura Temperatura The "11" is a number I gave to te param I have to read. Is it OK? Thank to all. Victor. vmartinezf@gmail.com

Guest Victor Martinez
Posted
Hi, I've solved the problem I shared last time, and now I've got another problem. This time I'llbe more specific. I'm developing an application programmed in VB.NET to display variables from a PLC S7-300 in my PC. I use a S7 connection with Ethernet to connect both. Programming the application, I've done a Sub in VB to display the values when the event AsyncReadComplete occurs, but I must have some parameters of the OPCgroupObject disabled, because the program never comes to the "sub". I've declared it as follows: Private Sub GroupObj_AsyncReadComplete(ByVal TransactionID As Integer, ByVal NumItems As Integer, ByRef ClientHandles As System.Array, ByRef ItemValues As System.Array, ByRef Qualities As System.Array, ByRef TimeStamps As System.Array, ByRef Errors As System.Array) Handles GroupObj.AsyncReadComplete I know there are some parameters such as GroupObj.IsSubscribed = True GroupObj.IsActive = True But I don't Know what are they for and how to use them. COUL ANYONE HELP ME? I've take as example some Siemens original samples. Thanks for all. Victor
Guest Victor Martinez
Posted
Thanks jacekd, I've read the document and seems really important. I´ve continued working with .NET, and I've found an error when programming the AsyncRead method of the OPC group. If you program the code whit VB6, the syntax of this is: AsyncRead( NumItems As Long, ServerHandles() As Long, ByRef Errors() As Long, TransactionID As Long, ByRef CancelID As Long) But when programming in VB.NET, the syntax changes and the ServerHandles() and Errors() are now System.Array type, instead of Long. In the document from the OPC Fundation: OPC Data Access Automation Specification2.02 the one used in VB6 is correct, but VB.NET doesn't let me declare ServerHandle as Long. I've tried putting it as System.Array, but it causes me another design error in: ServerHandle(1) = ItemObj1.ServerHandle WHAT COULD I DO? Can I Change the type of the array using a function?
Posted
I know you can pull data to/from a CP-343-1 directly using TCP/UDP & windows sockets bypassing the need for an OPC server. If this sounds like a better option for you I can get you some documentation but I also know 0 VB. I did the PLC side for this while the customer supplied the VB.
Posted
Depending on what data you want to transfer the even easier way might be to use the CP343-1 IT and an FTP server. I approached my first comms project with considerable trepidation a few weeks ago and was totally surprised when it turned out to be dead easy. Not a lot of help if you're committed to the CP343-1 and can't change it, I'm afraid! Just checked back through the post and seen that you're a student, so if this is supposed to a an exercise in VB, then the above is irrelevant. For those living and working in the real world, it does make life easier though!
Posted
do you have any manual reference of communication command or protocol of S7-200 i need it in order to make an aplication with VB send command to write memory send command to read memory send command to write status etc emm i think its semiliar with hostlink command in OMRON PLC thx
Posted
For the person asking about S7-200 and VB: Siemens offers an OPC server called S7-200 PC Access for the S7-200. You might want to consider that and then you can use VB to access the data once the OPC server has it.
Posted
Hello, Libnodave is a free software to communicate with PLC S7-200 and S7-300/400 and now you can use it under VB VBA, there are examples for VB and Excel includet. The text is in English. You can download it here:libnodave sorry for my English dietmar

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...