This tutorial will guide you exactly how to make use of COPC32 on Visual Basic.NET. You need to install COPC32 on your system before create SCADA with Visual.NET and also COPC32 ActiveX control. And also we suppose that you have OPC Web server on your local system already.
We will certainly create the simple type to review as well as contact OPC server on neighborhood systems. But you would certainly, like to link to remote OPC server. Please set up DCOM on both server and customer side by describe tutorial of KEPWare at http://www.kepware.com/Support_Center/Viewlets/XP_sp2_viewlet_swf.html
The type we will certainly develop is received Figure 1.
Number 1
When individual insert numeric value in textbox and click switch ‘& lsquo; Compose ‘, COPC32 will contact OPC tag as well as show its worth on ‘& lsquo
- ; Label1 ‘. Open Up Visual Studio.NET as well as crate new task with VB.NET
Figure 2
Kind the name of this job as “& ldquo; TestCOPC32VBNET &
rdquo;. 2. Add COPC32 ActiveX control into tool kit by select food selection Tools > > Add/Remove Tool kit Things & hellip;
Number 3
After that pick COPC32 received Figure 4.
Figure 4
Then click “& ldquo;
OK & rdquo; 3. Crate a button, a textbox and label on form like received Number 1
you can find more here https://freewindows10download.com/soft/copc32 from Our Articles
. 4. Select in tool kit as well as drag out the kind.
5. Right click COPC32 control on the kind and also choose ActiveX residential or commercial properties.
Figure 5
Set upgrade rate to 100 msec. And pick OPC Web server name to preferred OPC Server. You have to go into IP address or machine name in ‘& lsquo; nodname ‘ textbox if you would love to attach to remote OPC server over the network.
Number 6
6. Select OPC Tag you would love 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 displayed in Figure 8.
Number 8 OPC Tag residential or commercial properties.
Figure 9 Configure OPC tag index number = 0
And click OK to exit building 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
As well as see “& ldquo; How to load OPC tags from CSV data”&
rdquo;. 7. Dual click the form to get in to Form_Load event code sight.
8. Create the code to attach to OPC server as well as obtain value of OPC tag index 0 to reveal on Label1.
Exclusive Below Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Manages MyBase. Tons
Axcopc1.cnnec()
Label1.Text = Convert.ToString(Axcopc1.GetVl( 0 ))
End Below
Keep in mind: If you have set up various other OPC tag such as OPC tag index number = 1. You can get its value utilizing ‘& lsquo
; GetVl( “1)’”. 9. Select & ldquo; Closing & rdquo;
event name from
dropdown. Number 10 And produce the code like adhering to
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Takes care of MyBase. Closing
Application.DoEvents()
Axcopc1.discnn()
End Below
Note: We use “& ldquo; Application.DoEvents()” & rdquo; to waiting other task to finish before detach from OPC Server.
10. Back to design sight. Double click on COPC32 control on the type to go into to “& ldquo; datChange & rdquo; event code sight. After that create the code to display OPC tag value on Label1 when the vale of OPC tag we are connected has actually transformed.
Personal Sub Axcopc1_datChange(ByVal sender As Object, ByVal e As System.EventArgs) Manages Axcopc1.datChange
Label1.Text = Convert.ToString(Axcopc1.GetVl( 0 ))
End Below
11. Back to create design sight. Dual click button ‘& lsquo; Compose ‘. Then develop code to create vale to OPC tag which has index number = 0.
Exclusive Below Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Manages Button1.Click
Axcopc1.opcWrt(0, Convert.ToDouble(TextBox1.Text))
End Sub
12. Examination program by click F5. Place the number into textbox and also click ‘& lsquo; Create ‘. You might see the vale displayed in label is equal to your get in number.
Number 11
The complete associated code is displayed in Number 12.