WANTED: Usage COPC32 on Visual Basic.NET

This tutorial will assist you exactly how to utilize COPC32 on Aesthetic Basic.NET. You need to mount COPC32 on your system prior to produce SCADA with Visual.NET as well as COPC32 ActiveX control. As well as we suppose that you have OPC Web server on your neighborhood system currently.

We will develop the easy type to review and write to OPC server on local systems. However you would, like to attach to remote OPC web server. Please set up DCOM on both server and also 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 develop is displayed in Figure 1.

Number 1

When individual insert numeric value in textbox as well as click switch ‘& lsquo; Write ‘, COPC32 will certainly write to OPC tag and show its worth on ‘& lsquo

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

Figure 2

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

rdquo;. 2. Add COPC32 ActiveX control into tool kit by choose menu Devices > > Add/Remove Toolbox Items & hellip;

Figure 3

After that select COPC32 received Figure 4.

Number 4

After that click “& ldquo;

OK & rdquo; 3. Crate a button, a textbox as well as tag on form like shown in Number 1
Read more COPC32 Free At website Articles

. 4. Select in tool kit as well as drag out the kind.

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

Figure 5

Establish upgrade price to 100 msec. And also pick OPC Server name to wanted OPC Web server. You have to go into IP address or equipment name in ‘& lsquo; nodname ‘ textbox if you want to link to remote OPC server over the network.

Number 6

6. Select OPC Tag you wish to connect to.

Figure 7

Click OK.

This OPC Tag could be Readable and Writable. You can check on your OPC Server like received Number 8.

Number 8 OPC Tag residential or commercial properties.

Number 9 Configure OPC tag index number = 0

As well as click OK to exit property web pages.

Note: You can set up linked OPC tags by import OPC tag checklist from CSV documents which export from OPC Web server. Please refer to

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

And also see “& ldquo; Exactly how to pack OPC tags from CSV documents”&

rdquo;. 7. Dual click the type to get in to Form_Load event code view.

8. Create the code to connect to OPC web server and also obtain value of OPC tag index 0 to show on Label1.

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

Axcopc1.cnnec()

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

End Sub

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

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

occasion name from

dropdown. Number 10 As well as produce the code like following

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

Application.DoEvents()

Axcopc1.discnn()

End Below

Note: We make use of “& ldquo; Application.DoEvents()” & rdquo; to waiting other task to end up before disconnect from OPC Web server.

10. Back to develop sight. Double click COPC32 control on the type to get in to “& ldquo; datChange & rdquo; occasion code sight. Then create the code to display OPC tag worth on Label1 when the vale of OPC tag we are attached has changed.

Personal Below 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 view. Dual click button ‘& lsquo; Create ‘. Then create code to compose vale to OPC tag which has index number = 0.

Exclusive Below 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. Put the number right into textbox and click ‘& lsquo; Compose ‘. You might see the vale received label is equal to your go into number.

Number 11

The overall relevant code is received Figure 12.

For more information contacts us here

Share

Share on facebook
Share on whatsapp
Share on twitter
Share on linkedin
Share on skype
Share on email

Adonia Waibale

Armed with a major in Graphic Design and Painting, Mike

joined Graphic Systems (U) Limited, moved to Coolgraphix,

then to Ignition Limited and finally found his home in MAAD

Limited.

Over the decades, he has worked as a Graphic Designer

and Production Manager on various brands, like Capital

Markets Authority, Uganda Securities Exchange, Allied

Bank (now Bank of Africa), National Insurance Corporation,

Alexander Forbes, Orange Uganda, Tropical Bank, KCCA,

Bank of Africa, Warid Telecom Uganda, Standard Chartered

Bank, New Vision, Uganda Breweries Limited, UNICEF,

Uganda Health Marketing Group, Communication for

Healthy Communities, Western Union, IFC, LIDTECH, JESA,

UGACHICK, Power Play Energy Drink, among others.