<< 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 this event to check when a writing or reading failure occurred. Event variables receive information about this error. With these values, users can track back I/O Tags with I/O problems.
OnCommError event variables
Name |
Description |
---|---|
EvtType |
Informs which type of operation an I/O Driver was performing when this error occurred, according to the following options: •0: Single I/O Block Element reading error (Size = 1). Param1 is N1, Param2 is N2, Param3 is N3, and Param4 is N4 •1: Single I/O Block Element writing error (Size = 1). Param1 is N1, Param2 is N2, Param3 is N3, and Param4 is N4 •2: I/O Block reading error. Size is determined by the number of I/O Block Elements. Param1 is N1, Param2 is N2, Param3 is N3, and Param4 is N4 •3: I/O Block writing error. Size is determined by the number of I/O 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 I/O Block Element being read or written inside an I/O 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 |
The next script contains an example of using this event.
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