EasyManua.ls Logo

Allen-Bradley SoftLogix 5800

Allen-Bradley SoftLogix 5800
272 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Rockwell Automation Publication 1789-UM002K-EN-P - January 2015 157
Program Windows Events to Monitor and Change Controller Execution Chapter 8
On Error GoTo noHandle
ErrorCodeEvent1 = 0
hOutbound(0) = CreateEvent(ByVal 0&, 0, 0, "SOFTLOGIX_01_SHUTDOWN")
ErrorCodeEvent1 = Err.LastDllError
hOutbound(1) = CreateEvent(ByVal 0&, 0, 0, "SOFTLOGIX_01_PROGRAM")
ErrorCodeEvent1 = Err.LastDllError
hOutbound(2) = CreateEvent(ByVal 0&, 0, 0, "SOFTLOGIX_01_RUN")
ErrorCodeEvent1 = Err.LastDllError
hCounter = CreateEvent(ByVal 0&, 0, 0, "Counter")
ErrorCodeEvent1 = Err.LastDllError
If ErrorCodeEvent1 <> 183 Then '183 = Event already exists which is OK
'handle error
End If
noHandle:
End Sub
Private Sub Form_Unload(Cancel As Integer)
CloseHandle (hCounter)
CloseHandle (hOutbound(0))
CloseHandle (hOutbound(1))
CloseHandle (hOutbound(2))
End Sub
Private Sub pbCounter_Click(Index As Integer)
Dim ErrorCodeEvent1 As Long
SetEvent (hCounter)
ErrorCodeEvent1 = Err.LastDllError
If ErrorCodeEvent1 Then
'Handle error
End If
End Sub
Private Sub Timer1_Timer()
Dim inMode As Long
Dim ErrorDescription As String
inMode = WaitForMultipleObjects(3&, hOutbound(0), False, 0)
Select Case inMode
Case WAIT_OBJECT_0 + 2
Label3.BackColor = &HFF00&
Label3.Caption = "Run Mode"
Case WAIT_OBJECT_0 + 1
Label3.BackColor = &HFF8080
Label3.Caption = "Program Mode"
Case WAIT_OBJECT_0
Label3.BackColor = &HFF00FF
Label3.Caption = "SHUTDOWN Mode"
Case Else
Label3.BackColor = &HFFFFFF
Label3.Caption = "Other Mode"
End Select
End Sub

Table of Contents

Related product manuals