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_OB 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()));
}
}
Содержание SoftLogix 5800
Страница 1: ...SoftLogix 5800 System Catalog Numbers 1789 L10 1789 L30 1789 L60 User Manual...
Страница 4: ...4 Rockwell Automation Publication 1789 UM002K EN P January 2015 Summary of Changes Notes...
Страница 104: ...104 Rockwell Automation Publication 1789 UM002K EN P January 2015 Chapter 5 Configure and Use Simulated I O Notes...
Страница 110: ...110 Rockwell Automation Publication 1789 UM002K EN P January 2015 Chapter 6 Execute External Routines 9 Click OK...
Страница 148: ...148 Rockwell Automation Publication 1789 UM002K EN P January 2015 Chapter 7 Develop External Routines Notes...
Страница 256: ...256 Rockwell Automation Publication 1789 UM002K EN P January 2015 Appendix E System Performance Tuning Guidelines Notes...
Страница 262: ...262 Rockwell Automation Publication 1789 UM002K EN P January 2015 Appendix G SoftLogix 5800 Revision History Notes...
Страница 270: ...270 Rockwell Automation Publication 1789 UM002K EN P January 2015 Index...
Страница 271: ......