OPC UA Client in Vb|OPC UA Implementation: Stacks, Tools, and Samples|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
OPC UA Client in Vb
Avatar
Lindsey Williams
New Member
Members
Forum Posts: 2
Member Since:
08/30/2018
sp_UserOfflineSmall Offline
1
11/19/2018 - 07:02
sp_Permalink sp_Print

Good Afternoon,

I have been spending some time developing a simple OPC UA client. Which primary task is to read tags from a S7-1500 PLC. I've managed using the Siemens.OPCUa.dll to connect to the server and read tag values. However I am finding it hard to Write values. I have included some simple code below which shows connecting to the server and reading tag values. If anyone could point me in the right direction for writing Boolean values to nodes/tags it would be much appreciated.Embarassed

 

    Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim Serc = New Server()

        Serc.Connect("opc.tcp://192.168.0.1:4840")

        Dim nodei As NodeId

        nodei = "ns=3;s=""one"""

        Dim z = Serc.Session.ReadValue(nodei)

        PingTextBox.Text = z.Value

    End Sub

 

 

Thank you,

Lindsey Williams

Avatar
Randy Armstrong
Admin
Forum Posts: 1457
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
11/22/2018 - 07:11
sp_Permalink sp_Print

When using VB you must be careful with the datatypes.

i.e. if a field is UInt32 you must write a UInt32 - not an Int32 or a UInt16.

With boolean you must write a Boolean. Int32 value will not work.

Avatar
Lindsey Williams
New Member
Members
Forum Posts: 2
Member Since:
08/30/2018
sp_UserOfflineSmall Offline
3
11/22/2018 - 07:50
sp_Permalink sp_Print

Thankyou Randy!Laugh I will be writing Boolean values only.

 

Could you help me with what instruction I would use to write?

It seems very easy to connect and read but I'm guessing writing is a more complex procedure?

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 13
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1353
Posts: 4589