Usage COPC32 on Visual Basic.NET

This tutorial will assist you just how to utilize COPC32 on Aesthetic Basic.NET. You need to set up COPC32 on your system prior to produce SCADA with Visual.NET and COPC32 ActiveX control. As well as we expect that you have OPC Server on your local system already.

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

The form we will certainly create is received Figure 1.

Number 1

When user insert numeric value in textbox and also click switch ‘& lsquo; Compose ‘, COPC32 will contact OPC tag and also reveal its worth on ‘& lsquo

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

Figure 2

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

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

Number 3

Then select COPC32 displayed in Figure 4.

Figure 4

After that click “& ldquo;

OK & rdquo; 3. Crate a button, a textbox and also label on kind like shown in Figure 1
More Here freewindows10download.com At our site

. 4. Select in tool kit and drag out the type.

5. Right click on COPC32 control on the kind as well as choose ActiveX properties.

Figure 5

Establish upgrade price to 100 msec. And also choose OPC Web server name to preferred OPC Web server. You have to go into IP address or equipment name in ‘& lsquo; nodname ‘ textbox if you would like to connect to remote OPC web server over the network.

Number 6

6. Select OPC Tag you wish to link to.

Number 7

Click OK.

This OPC Tag could be Understandable and Writable. You can look at your OPC Web server like received Number 8.

Figure 8 OPC Tag residential or commercial properties.

Figure 9 Configure OPC tag index number = 0

As well as click OK to leave building web pages.

Keep in mind: You can set up connected OPC tags by import OPC tag checklist from CSV file which export from OPC Web server. Please describe

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

And also see “& ldquo; Just how to fill OPC tags from CSV file”&

rdquo;. 7. Dual click on the form to go into to Form_Load occasion code view.

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

Private Below Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Manages MyBase. Lots

Axcopc1.cnnec()

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

End Sub

Keep in mind: If you have configure various other OPC tag such as OPC tag index number = 1. You can obtain its worth making use of ‘& lsquo

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

event name from

dropdown. Number 10 And also produce the code like complying with

Private Below Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Takes care of MyBase. Closing

Application.DoEvents()

Axcopc1.discnn()

End Below

Note: We utilize “& ldquo; Application.DoEvents()” & rdquo; to waiting other job to end up before detach from OPC Web server.

10. Back to make sight. Dual click COPC32 control on the kind to enter to “& ldquo; datChange & rdquo; event code sight. Then create the code to display OPC tag value on Label1 when the vale of OPC tag we are linked has actually changed.

Personal Sub Axcopc1_datChange(ByVal sender As Object, ByVal e As System.EventArgs) Deals with Axcopc1.datChange

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

End Sub

11. Back to develop style sight. Dual click switch ‘& lsquo; Compose ‘. Then create code to compose vale to OPC tag which has index number = 0.

Personal Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Deals with Button1.Click

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

End Sub

12. Test program by click F5. Insert the number into textbox as well as click ‘& lsquo; Compose ‘. You can see the vale shown in label is equal to your enter number.

Number 11

The overall related code is received Figure 12.