Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters

Please confirm you want to mark all posts read

Mark all topics read

sp_MobileMenu Actions
Avatar

New/Updated Topics

Select Forum

sp_TopicIcon
OPC UA Client in Vb
Avatar
Lindsey Williams
Posts: 2
11/19/2018 - 07:02

1

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
Posts: 1672
11/22/2018 - 07:11

2

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
Posts: 2
11/22/2018 - 07:50

3

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: 1271
Currently Online:
Guest(s) 1148
Currently Browsing this Page:
1 Guest(s)

Devices in use: Desktop (1141), Phone (7)

Forum Stats:
Groups: 2
Forums: 10
Topics: 1519
Posts: 5142