Guest Victor Martinez Posted October 4, 2004 Report Posted October 4, 2004 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 Quote
jacekd Posted October 7, 2004 Report Posted October 7, 2004 Could you be a little more specific ? How did you connect PLC and PC ? What communication software do you use ? Quote
Guest Victor Martinez Posted October 13, 2004 Report Posted October 13, 2004 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 Quote
jacekd Posted October 13, 2004 Report Posted October 13, 2004 Seems like you are playing with OPC-DA. Grab the file below then. OPC_DA_Auto_2.02_Specification.exe Quote
Guest Victor Martinez Posted October 14, 2004 Report Posted October 14, 2004 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? Quote
jacekd Posted October 14, 2004 Report Posted October 14, 2004 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. Quote
DesertDog Posted November 3, 2004 Report Posted November 3, 2004 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. Quote
RMA Posted November 4, 2004 Report Posted November 4, 2004 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! Quote
@q_spasi Posted October 7, 2005 Report Posted October 7, 2005 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 Quote
Crossbow Posted October 10, 2005 Report Posted October 10, 2005 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. Quote
@q_spasi Posted October 11, 2005 Report Posted October 11, 2005 i have no Communication Processor CP, there is only peripheral port for PG device at the plc module. hiks... we need the protocol please... Quote
lorenz2512 Posted October 20, 2005 Report Posted October 20, 2005 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 Quote
Recommended Posts
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.