PLC S7 via OPCServer - Problem write data

atikin

Member
Join Date
Nov 2003
Posts
3
I'm writing an application to use OPCserver to connect on PLC (412 Siemens).
The read is all ok :rolleyes: , 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 :(
 
MyValues(1) = Value

--> GroupRead.SyncWrite(1, Serverhandles, MyValues, MyErrors)

maybe
--> GroupRead.SyncWrite(1, Serverhandles, MyValues(1), MyErrors)
 
seppoalanen said:
MyValues(1) = Value

--> GroupRead.SyncWrite(1, Serverhandles, MyValues, MyErrors)

maybe
--> GroupRead.SyncWrite(1, Serverhandles, MyValues(1), MyErrors)
On monday I'll try, but .NET say me that the sub have these syntax:
GroupRead.SyncWrite(integer, system.array, system.array,system.array)

Thanx
Gianfranco
 

Similar Topics

Hi everyone, I want to upload the program from my CPU317TF-2 DP to my PC via connecting to CP 343-1 Advanced since it has LAN ports and the CPU...
Replies
1
Views
167
Hi; I have Laptop Lenovo Thinkpad (W10) which don't have built-in Bluetooth. I have a PLC having Bluetooth communication device. I wanted to...
Replies
1
Views
129
Dear all, I have fx3u series plc with built in rs422 port and usb-sc09-fx cable. I have a a hyperterminal like application to send and receive...
Replies
8
Views
222
Hi All, Got a funny issue. I have a 1756-L85EP and a 1756-EN2TR in the same chase. The client asked for the Ferrari and the 3 lane highway!!! We...
Replies
1
Views
168
Hi All, I am facing one issue with the SEW MDX61B drive. Issue- I want to run a conveyor with this drive in two directions but it runs in...
Replies
0
Views
339
Back
Top Bottom