This tutorial will certainly guide you just how to utilize COPC32 on Visual Basic.NET. You have to set up COPC32 on your system prior to develop SCADA with Visual.NET as well as COPC32 ActiveX control. And also we mean that you have OPC Server on your regional system currently.

We will develop the basic type to review as well as contact OPC web server on local systems. But you would certainly, like to attach to remote OPC web server. Please configure DCOM on both server and also customer side by describe tutorial of KEPWare at http://www.kepware.com/Support_Center/Viewlets/XP_sp2_viewlet_swf.html

The form we will create is displayed in Number 1.

Figure 1

When customer insert numeric value in textbox and also click button ‘& lsquo; Create ‘, COPC32 will certainly contact OPC tag as well as reveal its value on ‘& lsquo

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

Figure 2

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

rdquo;. 2. Add COPC32 ActiveX control right into toolbox by choose menu Tools > > Add/Remove Toolbox Items & hellip;

Number 3

Then select COPC32 received Number 4.

Number 4

Then click “& ldquo;

OK & rdquo; 3. Crate a switch, a textbox and tag on type like received Figure 1
Read more COPC32 Download At website Articles

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

5. Right click COPC32 control on the form and also select ActiveX residential or commercial properties.

Figure 5

Establish upgrade rate to 100 msec. As well as select OPC Server name to desired OPC Web server. You need to enter IP address or equipment name in ‘& lsquo; nodname ‘ textbox if you want to connect to remote OPC server over the network.

Figure 6

6. Select OPC Tag you would love to link to.

Figure 7

Click OK.

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

Figure 8 OPC Tag properties.

Figure 9 Configure OPC tag index number = 0

And click OK to leave residential property pages.

Keep in mind: You can set up connected OPC tags by import OPC tag list from CSV data 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 documents”&

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

8. Produce the code to connect to OPC server as well as obtain value of OPC tag index 0 to show on Label1.

Personal Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Deals with MyBase. Tons

Axcopc1.cnnec()

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

End Below

Note: If you have configure various other OPC tag such as OPC tag index number = 1. You can get its value making use of ‘& lsquo

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

occasion name from

dropdown. Number 10 And also develop the code like following

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

Application.DoEvents()

Axcopc1.discnn()

End Sub

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

10. Back to create view. Double click on COPC32 control on the type to enter to “& ldquo; datChange & rdquo; event code view. Then produce the code to present OPC tag worth on Label1 when the vale of OPC tag we are attached has changed.

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

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

End Sub

11. Back to create design sight. Double click on button ‘& lsquo; Compose ‘. After that produce code to write vale to OPC tag which has index number = 0.

Exclusive Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Manages Button1.Click

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

End Sub

12. Examination program by click F5. Place the number right into textbox as well as click ‘& lsquo; Create ‘. You could see the vale displayed in tag amounts to your enter number.

Number 11

The complete related code is received Number 12.