Rockwell Automation Publication 1789-UM002K-EN-P - January 2015
153
Program Windows Events to Monitor and Change Controller Execution
Chapter 8
_tprintf(_T("Mode change occured: "));
fflush(stdout);
break;
}
// A mode change occured. Now we have to check to determine the new controller mode.
// This is done by performing a WaitForMultipleObjects on the mode event handles.
// These events are manual reset events that are controlled by the SoftLogix
// controller.
// Only one of these events can be set at any given time.
// Log a message to the screen indicating the new controller mode, and then go back
// to waiting for the mode change event above.
status = WaitForMultipleObjects(numevents, EventArray, FALSE, INFINITE);
switch (status)
{
case WAIT_OBJECT_0:
_tprintf(_T("now in program mode\n"));
fflush(stdout);
break;
case WAIT_O1:
_tprintf(_T("now in run mode\n"));
fflush(stdout);
break;
case WAIT_O2:
_tprintf(_T("now in test mode\n"));
fflush(stdout);
break;
case WAIT_O3:
_tprintf(_T("now in fault mode\n"));
fflush(stdout);
break;
}
}
return 0;
}
Configure Windows Events to
Launch Tasks within the
SoftLogix Controller
Windows event tasks are functionality associated with Microsoft’s
Windows 2000 and Windows XP operating systems. Applications outside of the
Logix Designer application (Visual Basic, RSView, Custom C applications,
external routines, and so forth) can cause a task within the SoftLogix5800
controller to execute.
Configure a Windows-event Task in the Controller
In the SoftLogix project, we will create a task and configure the trigger as a
Windows event on the controller. Follow these steps.
1.
Launch the Logix Designer application.
2.
Open the controller1 project we created previously.
3.
In the Controller Organizer, right-click Tasks folder and choose
New Task.