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 #133 background imageLoading...
Page #133 background image
Rockwell Automation Publication 1789-UM002K-EN-P - January 2015 133
Develop External Routines Chapter 7
if (oldRungState != rungState)
{
oldRungState = rungState;
switch (oldRungState) {
case FIRST_SCAN:
PlaySound("FIRSTSCAN");
break;
case RUNG_TRUE:
PlaySound("RUNGTRUE");
break;
case RUNG_FALSE:
PlaySound("RUNGFALSE");
break;
default:
exitThread = TRUE;
}
}
break;
case WAIT_OBJECT_0 + 1:
exitThread = TRUE;
case WAIT_TIMEOUT:
case WAIT_ABANDONED:
case WAIT_FAILED:
exitThread = TRUE;
}
}
CloseHandle(hController);
_endthread();
}
extern "C" __declspec(dllexport) void SayRungState(EXT_ROUTINE_CONTROL * pERCtrl)
{
pERCtrl->ctrlWord.EN = pERCtrl->ctrlWord.EnableIn;
rungState = INVALID_STATE;
// Only create the thread on prescan.
if (pERCtrl->ctrlWord.ScanType == 1)
{
hControllerState = CreateEvent(NULL, FALSE, TRUE, NULL);
if (hControllerState)
{
HANDLE hThread;
hThread = (HANDLE) _beginthread (RungStateThread,
0, // stack size
hControllerState); // arglist
if (hThread != INVALID_HANDLE_VALUE)
{
// The following code will set the thread's priority to the
// same priority as the task that invoked the external routine.
// If the thread is not performing time-critical work, then
// it is recommended that you set its priority to
// THREAD_PRIORITY_IDLE, i.e.
// SetThreadPriority (hThread, THREAD_PRIORITY_IDLE);
SetThreadPriority (hThread,
GetThreadPriority(GetCurrentThread()));
}
}

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