Sign in to follow this  
Followers 0
Guest Victor Martinez

VB and Siemens S300

12 posts in this topic

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

Share this post


Link to post
Share on other sites
Could you be a little more specific ? How did you connect PLC and PC ? What communication software do you use ?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Seems like you are playing with OPC-DA. Grab the file below then. OPC_DA_Auto_2.02_Specification.exe

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
On OPC Foundation there're forums for all flavours of OPC. My knowledge of .NET = 0 so I can't be much more of help.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
i have no Communication Processor CP, there is only peripheral port for PG device at the plc module. hiks... we need the protocol please...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0