OnCommError

<< Click to Display Table of Contents >>

 

OnCommError

OnCommError(EvtType, Size, Element, N1, N2, N3, N4)

Occurs when an I/O Driver detects any writing or reading error. Use an OnCommError event to check when a writing or reading failure occurred in the I/O Driver. Event variables receive information about this error. With these values, users can track back Tags with I/O problems.

OnCommError event variables

Name

Description

EvtType

Informs which type of operation a Driver was performing when this error occurred, according to the following options:

0: Single Element reading error (Size = 1). Param1 is N1, Param2 is N2, Param3 is N3, and Param4 is N4

1: Single Element writing error (Size = 1). Param1 is N1, Param2 is N2, Param3 is N3, and Param4 is N4

2: Block reading error (I/O Block). Size is determined by the number of Block Elements. Param1 is N1, Param2 is N2, Param3 is N3, and Param4 is N4

3: Block writing error (I/O Block). Size is determined by the number of Block Elements. Param1 is N1, Param2 is N2, Param3 is N3, and Param4 is N4

Size

Number of values being read or written

Element

Index of the Element being read or written inside a Block

N1

First parameter of a reading or writing operation that generated this error

N2

Second parameter of a reading or writing operation that generated this error

N3

Third parameter of a reading or writing operation that generated this error

N4

Fourth parameter of a reading or writing operation that generated this error

 

Example:

Sub Driver1_OnCommError(Type, Size, Element, N1, N2, N3, N4)
  Application.GetObject("Data.InternalTag1").Value = _
    Application.GetObject("Data.InternalTag1").Value + 1
  Application.GetObject("Data.EvtType").Value = EvtType
  Application.GetObject("Data.Size").Value = Size
  Application.GetObject("Data.Element").Value = Element
  Application.GetObject("Data.N1").Value = N1
  Application.GetObject("Data.N2").Value = N2
  Application.GetObject("Data.N3").Value = N3
  Application.GetObject("Data.N4").Value = N4
End Sub

Was this page useful?