Frozen Pints Frozen Pints Home About Us Flavors Find Us Blog Contact Us

What's Cool

Usage COPC32 on Visual Basic.NET

Posted on December 2, 2020 by ari

This tutorial will certainly guide you just how to use COPC32 on Aesthetic Basic.NET. You need to set up COPC32 on your system prior to develop SCADA with Visual.NET and also COPC32 ActiveX control. As well as we expect that you have OPC Web server on your neighborhood system currently.

We will certainly produce the simple kind to check out and also write to OPC web server on neighborhood systems. Yet you would certainly, like to link to remote OPC server. Please set up DCOM on both web 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 certainly develop is shown in Figure 1.

Number 1

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

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

Number 2

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

rdquo;. 2. Include COPC32 ActiveX control into tool kit by pick menu Tools > > Add/Remove Tool kit Products & hellip;

Number 3

After that select COPC32 displayed in Figure 4.

Figure 4

Then click “& ldquo;

OK & rdquo; 3.by link COPC32 free download website Crate a switch, a textbox and also tag on type like received Number 1

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

5. Right click COPC32 control on the kind and also choose ActiveX residential properties.

Figure 5

Set update rate to 100 msec. And pick OPC Server name to preferred OPC Web server. You have to go into IP address or machine name in ‘& lsquo; nodname ‘ textbox if you want to connect to remote OPC server over the network.

Figure 6

6. Select OPC Tag you wish to connect to.

Figure 7

Click OK.

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

Number 8 OPC Tag residential or commercial properties.

Figure 9 Configure OPC tag index number = 0

As well as click OK to leave residential property web pages.

Keep in mind: You can configure connected OPC tags by import OPC tag listing from CSV documents which export from OPC Server. Please describe

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

As well as see “& ldquo; Exactly how to fill OPC tags from CSV data”&

rdquo;. 7. Double click on the type to enter to Form_Load occasion code sight.

8. Develop the code to link to OPC server as well as obtain value of OPC tag index 0 to reveal on Label1.

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

Axcopc1.cnnec()

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

End Below

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

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

occasion name from

dropdown. Figure 10 As well as develop the code like adhering to

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

Application.DoEvents()

Axcopc1.discnn()

End Below

Note: We utilize “& ldquo; Application.DoEvents()” & rdquo; to waiting other job to complete before separate from OPC Server.

10. Back to develop view. Dual click on COPC32 control on the kind to get in to “& ldquo; datChange & rdquo; event code view. Then produce the code to display OPC tag value on Label1 when the vale of OPC tag we are attached has actually altered.

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

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

End Below

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

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

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

End Below

12. Test program by click F5. Place the number into textbox and click ‘& lsquo; Write ‘. You can see the vale displayed in tag amounts to your get in number.

Number 11

The overall associated code is shown in Figure 12.

Leave a Reply

Your email address will not be published.

© 2012 Frozen Pints ™ Ice Cream. All Rights Reserved.             About Us | Flavors | Find Us | Blog | Contact Us | Home