Use COPC32 on Visual Basic.NET
6406
post-template-default,single,single-post,postid-6406,single-format-standard,bridge-core-2.0,ajax_fade,page_not_loaded,,qode_grid_1400,qode-theme-ver-19,qode-theme-bridge,disabled_footer_top,qode_header_in_grid,wpb-js-composer js-comp-ver-6.0.5,vc_responsive
 

Use COPC32 on Visual Basic.NET

Use COPC32 on Visual Basic.NET

This tutorial will assist you just how to utilize COPC32 on Visual Basic.NET. You have to mount 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 neighborhood system currently.

We will develop the basic kind to check out as well as write to OPC web server on neighborhood systems. But you would certainly, like to connect to remote OPC server. Please set up DCOM on both 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 kind we will certainly develop is displayed in Figure 1.

Number 1

When user insert numeric worth in textbox and also click switch ‘& lsquo; Create ‘, COPC32 will write to OPC tag as well as show its worth on ‘& lsquo

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

Number 2

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

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

Number 3

After that choose COPC32 displayed in Figure 4.

Figure 4

Then click “& ldquo;

OK & rdquo; 3.read about it COPC32 Free from Our Articles Crate a button, a textbox as well as tag on type like received Figure 1

. 4. Select in tool kit and drag on the kind.

5. Right click COPC32 control on the type as well as pick ActiveX residential or commercial properties.

Figure 5

Establish update rate to 100 msec. And also choose OPC Server name to desired OPC Web server. You need to go into IP address or maker name in ‘& lsquo; nodname ‘ textbox if you would like to connect to remote OPC server over the network.

Number 6

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

Figure 7

Click OK.

This OPC Tag could be Readable and also Writable. You can examine your OPC Server like shown in Number 8.

Figure 8 OPC Tag residential or commercial properties.

Number 9 Configure OPC tag index number = 0

As well as click OK to leave home pages.

Note: You can configure connected OPC tags by import OPC tag listing from CSV data which export from OPC Web server. Please refer to

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

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

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

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

Exclusive Below Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase. Lots

Axcopc1.cnnec()

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

End Sub

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

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

occasion name from

dropdown. Figure 10 And produce the code like adhering to

Personal Below Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Deals with MyBase. Closing

Application.DoEvents()

Axcopc1.discnn()

End Below

Keep in mind: We utilize “& ldquo; Application.DoEvents()” & rdquo; to waiting various other job to finish before disconnect from OPC Server.

10. Back to make view. Dual click on COPC32 control on the kind to enter to “& ldquo; datChange & rdquo; occasion code sight. Then produce the code to show OPC tag worth on Label1 when the vale of OPC tag we are connected has actually altered.

Private 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 Sub

11. Back to develop style sight. Dual click switch ‘& lsquo; Create ‘. After that develop code to write vale to OPC tag which has index number = 0.

Personal Below Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

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

End Below

12. Examination program by click F5. Place the number right into textbox and click ‘& lsquo; Write ‘. You could see the vale received tag amounts to your get in number.

Figure 11

The overall related code is shown in Figure 12.

No Comments

Sorry, the comment form is closed at this time.