Sức KhỏeKhông có phản hồi

default thumbnail

This tutorial will certainly 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 mean that you have OPC Server on your regional system already.

We will certainly create the easy kind to check out and also contact OPC web server on local systems. Yet you would certainly, like to link to remote OPC server. Please configure DCOM on both web server as well as customer side by describe tutorial of KEPWare at http://www.kepware.com/Support_Center/Viewlets/XP_sp2_viewlet_swf.html

The type we will develop is shown in Figure 1.

Number 1

When user insert numerical worth in textbox and click switch ‘& lsquo; Compose ‘, COPC32 will write to OPC tag and show its value on ‘& lsquo

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

Number 2

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

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

Number 3

Then select COPC32 shown in Number 4.

Number 4

Then click “& ldquo;

OK & rdquo; 3. Crate a switch, a textbox as well as tag on kind like shown in Number 1
follow the link COPC32 At our site

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

5. Right click COPC32 control on the form as well as choose ActiveX residential or commercial properties.

Number 5

Establish upgrade price to 100 msec. And select OPC Server name to desired OPC Web server. You need to get in IP address or device name in ‘& lsquo; nodname ‘ textbox if you wish to link to remote OPC server over the network.

Figure 6

6. Select OPC Tag you want to connect to.

Number 7

Click OK.

This OPC Tag could be Legible and Writable. You can look at your OPC Server like received Figure 8.

Number 8 OPC Tag residential or commercial properties.

Figure 9 Configure OPC tag index number = 0

And also click OK to exit residential property pages.

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


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

rdquo;. 7. Double click the kind to get in to Form_Load event code view.

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

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


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

End Below

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

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

event name from

dropdown. Number 10 And produce the code like adhering to

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



End Below

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

10. Back to make view. Dual click on COPC32 control on the form to get in to “& ldquo; datChange & rdquo; occasion code sight. Then produce the code to show OPC tag value on Label1 when the vale of OPC tag we are attached has transformed.

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

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

End Below

11. Back to develop layout view. Double click on button ‘& lsquo; Create ‘. After that create code to write 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. Examination program by click F5. Place the number right into textbox and click ‘& lsquo; Create ‘. You can see the vale displayed in label is equal to your enter number.

Number 11

The total relevant code is displayed in Number 12.

Hãy Là Người Trả Lời Câu Hỏi Đầu Tiên

Thêm Bình Luận