This tutorial will certainly lead you just how to utilize COPC32 on Aesthetic Basic.NET. You have to mount COPC32 on your system before develop SCADA with Visual.NET and also COPC32 ActiveX control. As well as we suppose that you have OPC Server on your neighborhood system currently.
We will produce the simple type to check out and also write to OPC server on neighborhood systems. However you would certainly, like to attach to remote OPC web server. Please set up DCOM on both web 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 certainly develop is shown in Number 1.
Figure 1
When individual insert numeric value in textbox and also click switch ‘& lsquo; Write ‘, COPC32 will certainly contact OPC tag as well as show its value on ‘& lsquo
- ; Label1 ‘. Open Up Visual Studio.NET and also crate new project with VB.NET
Figure 2
Type the name of this job as “& ldquo; TestCOPC32VBNET &
rdquo;. 2. Add COPC32 ActiveX control right into tool kit by pick menu Tools > > Add/Remove Toolbox Items & hellip;
Figure 3
Then select COPC32 received Number 4.
Number 4
After that click “& ldquo;
OK & rdquo; 3.More Here freewindows10download.com At our site Crate a switch, a textbox as well as label on form like displayed in Figure 1
. 4. Select in toolbox and drag on the kind.
5. Right click on COPC32 control on the type as well as pick ActiveX residential properties.
Number 5
Set update rate to 100 msec. As well as choose OPC Server name to wanted OPC Server. You have to enter IP address or maker name in ‘& lsquo; nodname ‘ textbox if you wish to attach to remote OPC server over the network.
Figure 6
6. Select OPC Tag you wish to attach to.
Number 7
Click OK.
This OPC Tag could be Understandable and also Writable. You can check on your OPC Web server like received Number 8.
Figure 8 OPC Tag buildings.
Figure 9 Configure OPC tag index number = 0
And click OK to exit residential property pages.
Note: You can configure connected OPC tags by import OPC tag checklist from CSV documents which export from OPC Web server. Please describe
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 on the type to get in to Form_Load occasion code view.
8. Create the code to link to OPC server and also get value of OPC tag index 0 to reveal on Label1.
Private Sub 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
Note: If you have set up various other OPC tag such as OPC tag index number = 1. You can obtain its worth using ‘& lsquo
; GetVl( “1)’”. 9. Select & ldquo; Closing & rdquo;
occasion name from
dropdown. Figure 10 And also develop the code like adhering to
Personal Below Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Manages MyBase. Closing
Application.DoEvents()
Axcopc1.discnn()
End Below
Note: We make use of “& ldquo; Application.DoEvents()” & rdquo; to waiting various other job to end up before detach from OPC Web server.
10. Back to develop view. Double click COPC32 control on the kind to enter to “& ldquo; datChange & rdquo; occasion code sight. After that produce the code to present OPC tag worth on Label1 when the vale of OPC tag we are linked has altered.
Private Below 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 view. Dual click button ‘& lsquo; Compose ‘. After that develop code to write vale to OPC tag which has index number = 0.
Personal Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Axcopc1.opcWrt(0, Convert.ToDouble(TextBox1.Text))
End Sub
12. Examination program by click F5. Insert the number into textbox as well as click ‘& lsquo; Write ‘. You might see the vale displayed in tag amounts to your enter number.
Number 11
The total relevant code is received Figure 12.