beckhoff TwinCAT 2 PLC Control — 10.7.1 FUNCTION CheckBounds

Appendix Requirements 10.6.2.5.3 SYSTEMTASKINFOARR VAR_GLOBAL SystemTaskInfoArr AT%MB32832(*The real address may differ! *) : ARRAY[1..4] OF SYSTEMTASKINFOTYPE; END_VAR System flags are implicitly declared variables that are different on each specific PLC. The type SYTEMTASKINFOTYPE is declared in the system library, so this library has to be included in the library manager. The index in this array is the task-Id. You can get the task-Id when you call the functionblock GETCURTASKINDEX from your task. Requirements 10.7 System Functions 10.7.1 FUNCTION CheckBounds If you define a function in your project with the name CheckBounds you can use it to check for range overflows in your project!

The name of the function is defined and may have only this identifier. An example of how this function is implemented is shown below: NOTE System load CheckBound function may cause increased system load. Please use CheckBounds only for test purposes. FUNCTION CheckBounds : DINT VAR_INPUT index, lower, upper : DINT; END_VAR Example of CheckBounds function implementation: IF index CheckBounds := lower; ELSIF index>upper THEN CheckBounds := upper; ELSE CheckBounds := index; END_IF TwinCAT 2 PLC Control 334 Version:

1.0 Development environment Target system type PLC libraries to include TwinCAT v2.7.0 PC (i386) PLCSystem.Lib TwinCAT v2.8.0 PC (i386) TcSystem.Lib Development environment Target system type PLC libraries to include TwinCAT v2.7.0 PC (i386) PLCSystem.Lib TwinCAT v2.8.0 PC (i386) TcSystem.Lib