Usage COPC32 on Visual Basic.NET

This tutorial will lead you just how to utilize COPC32 on Visual Basic.NET. You need to install COPC32 on your system before create SCADA with Visual.NET and also COPC32 ActiveX control. And also we mean that you have OPC Web server on your regional system already.

We will produce the easy kind to read as well as write to OPC web server on neighborhood systems. Yet you would certainly, like to connect to remote OPC server. Please set up DCOM on both server as well as customer side by refer to tutorial of KEPWare at http://www.kepware.com/Support_Center/Viewlets/XP_sp2_viewlet_swf.html

The type we will produce is displayed in Number 1.

Number 1

When individual insert numerical worth in textbox and click button ‘& lsquo; Create ‘, COPC32 will certainly contact OPC tag and also reveal its value on ‘& lsquo

  1. ; Label1 ‘. Open Visual Studio.NET and crate new task with VB.NET

Number 2

Kind the name of this task as “& ldquo; TestCOPC32VBNET &

rdquo;. 2. Include COPC32 ActiveX control into tool kit by choose food selection Tools > > Add/Remove Tool kit Things & hellip;

Figure 3

Then choose COPC32 received Number 4.

Figure 4

Then click “& ldquo;

OK & rdquo; 3. Crate a switch, a textbox as well as label on form like shown in Number 1
Read about https://freewindows10download.com/soft/copc32 At website

. 4. Select in toolbox and drag on the type.

5. Right click on COPC32 control on the type and also pick ActiveX properties.

Figure 5

Establish update price to 100 msec. And also choose OPC Server name to desired OPC Web server. You need to get in IP address or equipment name in ‘& lsquo; nodname ‘ textbox if you would love to attach to remote OPC web server over the network.

Number 6

6. Select OPC Tag you would like to connect to.

Number 7

Click OK.

This OPC Tag could be Understandable and also Writable. You can check on your OPC Server like displayed in Figure 8.

Number 8 OPC Tag buildings.

Figure 9 Configure OPC tag index number = 0

And also click OK to exit residential or commercial property pages.

Note: You can configure connected OPC tags by import OPC tag list from CSV documents which export from OPC Server. Please refer to

http://www.scadathai.com/COPC/COPCEng/tutorials.htm

As well as see “& ldquo; How to pack OPC tags from CSV documents”&

rdquo;. 7. Dual click on the kind to get in to Form_Load event code sight.

8. Produce the code to link to OPC server and also get value of OPC tag index 0 to show on Label1.

Personal Below Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Manages MyBase. Tons

Axcopc1.cnnec()

Label1.Text = Convert.ToString(Axcopc1.GetVl( 0 ))

End Sub

Keep in mind: If you have configure other OPC tag such as OPC tag index number = 1. You can get its worth using ‘& lsquo

; GetVl( “1)’”. 9. Select & ldquo; Closing & rdquo;

event name from

dropdown. Number 10 And produce the code like following

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase. Closing

Application.DoEvents()

Axcopc1.discnn()

End Below

Keep in mind: We utilize “& ldquo; Application.DoEvents()” & rdquo; to waiting other job to end up prior to separate from OPC Web server.

10. Back to design sight. Dual click COPC32 control on the form to get in to “& ldquo; datChange & rdquo; event code sight. After that develop the code to present OPC tag worth on Label1 when the vale of OPC tag we are linked has transformed.

Personal Below Axcopc1_datChange(ByVal sender As Object, ByVal e As System.EventArgs) Manages Axcopc1.datChange

Label1.Text = Convert.ToString(Axcopc1.GetVl( 0 ))

End Below

11. Back to develop style sight. Dual click on button ‘& lsquo; Create ‘. After that develop code to compose vale to OPC tag which has index number = 0.

Personal Below Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Axcopc1.opcWrt(0, Convert.ToDouble(TextBox1.Text))

End Sub

12. Test program by click F5. Place the number into textbox and also click ‘& lsquo; Create ‘. You could see the vale shown in tag is equal to your go into number.

Number 11

The complete related code is received Figure 12.