COPC32/COPCDLL OPC Data on Event Print
Written by Administrator   
Friday, 04 May 2018 16:49

In this article, I will show how to use OPC Data event to control something. For example, doing some operation if value of specified OPC Tag changed.


For COPCDLL, it is “datChange” event can be used to detect if specified OPC tags data changed or not.

The VS C# example  below shows if data of OPC tag which has index number 1 is changed, the code will write data value 111 to OPC tag has index number 2.


 Private Sub copc1_datChange(tagIndex As Integer) Handles copc1.datChange

            Select Case tagIndex
                Case 0

                Case 1
                    copc1.opcWrt(2, 111)

                Case 2

            End Select

        Catch ex As Exception

        End Try

    End Sub


For COPC32, it is event ‘datChngX’ can do the same operation.


The example below shows id (index numner) of OPC tag that it’s data is changed.

Private Sub Axcopc1_datChngX(sender As Object, e As AxCOPC32.__copc_datChngXEvent) Handles Axcopc1.datChngX

        Label1.Text =

    End Sub
Last Updated ( Friday, 04 May 2018 08:50 )