I'm writing an application to use OPCserver to connect on PLC (412 Siemens).
The read is all ok , but I've problem to write.
These is the source
-----------------------------------------------
Sub ScriviS7(ByRef Simbolico As String, ByRef Value As Int16)
Dim ItemWrite As OPCSiemensDAAutomation.OPCItem
Dim Serverhandles(2) As Long
Dim MyValues(2) As Int16
Dim MyErrors(2) As Long
On Error GoTo ErrorHandler
ItemWrite = OPCItemAdd(Simbolico, 2000)
Serverhandles(1) = ItemWrite.ServerHandle
MyValues(1) = Value
--> GroupRead.SyncWrite(1, Serverhandles, MyValues, MyErrors)
ItemObjW = Nothing
GroupRead.OPCItems.Remove(1, Serverhandles, MyErrors)
Exit Sub
ErrorHandler:
MsgBox(Err.Description , MsgBoxStyle.Critical, "ERROR")
Resume
end sub
sub Write()
ScriviS7("S7:[plc1]DB2,INT2,1", 12)
end sub
------------
I receave an error on the selected row (GroupRead.SyncWrite):
"The array is not of type aspected"
Please help Me
The read is all ok , but I've problem to write.
These is the source
-----------------------------------------------
Sub ScriviS7(ByRef Simbolico As String, ByRef Value As Int16)
Dim ItemWrite As OPCSiemensDAAutomation.OPCItem
Dim Serverhandles(2) As Long
Dim MyValues(2) As Int16
Dim MyErrors(2) As Long
On Error GoTo ErrorHandler
ItemWrite = OPCItemAdd(Simbolico, 2000)
Serverhandles(1) = ItemWrite.ServerHandle
MyValues(1) = Value
--> GroupRead.SyncWrite(1, Serverhandles, MyValues, MyErrors)
ItemObjW = Nothing
GroupRead.OPCItems.Remove(1, Serverhandles, MyErrors)
Exit Sub
ErrorHandler:
MsgBox(Err.Description , MsgBoxStyle.Critical, "ERROR")
Resume
end sub
sub Write()
ScriviS7("S7:[plc1]DB2,INT2,1", 12)
end sub
------------
I receave an error on the selected row (GroupRead.SyncWrite):
"The array is not of type aspected"
Please help Me