EasyManuals Logo

Allen-Bradley SoftLogix 5800 User Manual

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
Page #156 background imageLoading...
Page #156 background image
156 Rockwell Automation Publication 1789-UM002K-EN-P - January 2015
Chapter 8 Program Windows Events to Monitor and Change Controller Execution
Trigger a Controller Task from a Windows Application
In your application, such as Visual Basic or FactoryTalk software, use standard
Windows API functions to open and set the Windows event in the controller.
Make sure you do the following:
• Name the Windows-event task in the controller with the same name as the
Windows event in the external application.
• Open or create the Windows event in the external application as an
‘automatic reset’ event, otherwise the task within the controller executes
continuously once the Windows event is set.
• Use a CreateEvent call to create the Windows event; use a SetEvent call to
signal the Windows event.
Programming Example: Windows Event
This example, a Visual Basic application, uses Windows events to communicate
to a SoftLogix controller. The application passes data via a memory-mapped file
by using the Win32 standard library.
The following example code shows how you can create the public declarations:
Public Declare Function CreateEvent Lib "kernel32" Alias "CreateEventA" _
(lpEventAttributes As Any, ByVal bManualReset As Long, _
ByVal bInitialState As Long, ByVal lpName As String) As Long
Public Declare Function SetEvent Lib "kernel32" (ByVal hEvent As Long) As Long
The following example code shows how you can use the CreateEvent and
SetEvent calls. This example uses the shutdown, program, and run outbound
events (see page 149
) before executing the Windows event named ‘counter.’
There is a corresponding Windows-event task in the controller named ‘counter.’
Dim hCounter As Long
Dim hOutbound(3) As Long
Dim hCounter As Long
Private Sub Form_Load()
Dim ErrorCodeEvent1 As Long

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Allen-Bradley SoftLogix 5800 and is the answer not in the manual?

Allen-Bradley SoftLogix 5800 Specifications

General IconGeneral
BrandAllen-Bradley
ModelSoftLogix 5800
CategoryController
LanguageEnglish

Related product manuals