Connecting To OPC Server with Visual Basic

Sorry, Correcting the code (cancel my last post):

Code:
Private Sub Command1_Click()

Dim [COLOR=red]VarName[/COLOR]  As String
Dim [COLOR=blue]VarValue[/COLOR]  As Variant


[COLOR=red]VarName[/COLOR] = "Group.Subgroup.item" 
[COLOR=blue]VarValue[/COLOR] = 0 [COLOR=green]' Or 1[/COLOR] 

result = Form_name.OPCData1.WriteVariable([COLOR=red]VarName[/COLOR], [COLOR=blue]VarValue[/COLOR], 0)

End Sub
Notes:
1- Form_name is the form that contains the OPC client Active X control.
2- If I still remember, The variable that contains the value to be written in the PLC (i.e. VarValue = "Group.Subgroup.item") must be Variant type.

Also read the articles in This link. You will find very useful information.

Best regards.
 

Similar Topics

Hello PLC expert i need your help. i want to use OPC communication and Matlab to read and write data from/to a Logix5561. A Topic is...
Replies
0
Views
1,669
I have KEPserverEX on a host machine and FactoryTalk Hostorian SE on a virtual machine. The machines can ping each other so I can in theory...
Replies
1
Views
2,932
I have a moisture meter that I want connected so we can log data from it. The specs mention that it supports OPC-DDE, would that mean I can...
Replies
7
Views
2,625
hi, I am currently working on a project that requires access to the data inside plc using Codesys OPC server v2.3 and I want the data to be...
Replies
0
Views
3,051
Hey guys, I am trying to set up a Matrikon OPC server to connect to a Controllogix gateway. If I use RSLinx, I can see all my PLC5's...
Replies
1
Views
2,281
Back
Top Bottom