Object ‘POUs for implicit Checks’

You can add special POUs to an application to equip them with implicit monitoring functions. At runtime, these functions check the array limits or subrange types, the validity of pointer addresses, or division by zero. Please note: This option can be disabled for devices that are already equipped with these kinds of monitoring blocks by a special implicit library.

The Add Object ‣ POU for implicit checks command is used for adding to the application. Then the Add POU for implicit checks dialog box opens where you can selected a monitoring function type (see table below). Depending on the monitoring function, you have to adapt the implementation code or create it yourself from scratch.

To prevent multiple inclusions, monitoring functions that have already been inserted are disabled in the Add POU for implicit checks dialog box.

Attention

To obtain the feature for monitoring functions, do not edit the declaration section. However, you are permitted to add local variables.

After removing an implicit monitoring function (such as CheckBounds) from the project, only a download is possible, not an online change. A corresponding message is issued.

Note

CODESYS does not execute implicit checks for POUs from libraries.

You can use the attribute “no_check” to deactivate the check for special POUs in the project. However, you can apply the compiler definition checks_in_libs to extend the test to include modules from libraries.

Available functions
Monitoring function Type
CheckBounds

Bound checks

Appropriate handling of bound violations; such handling includes setting flags or changing field indices.

CheckDivDInt

Division checks:

Monitors the divisor value to avoid division by zero.

CheckDivLInt
CheckDivReal
CheckDivLReal
CheckRangeSigned

Range checks:

Monitors the range limit of a subrange type in runtime mode. Applies to data types DINT/UDINT.

CheckRangeUnsigned
CheckLRangeSigned

L-range checks:

Monitors the range limit of a subrange type in runtime mode. Applies to data types LINT/ULINT.

CheckLRangeUnsigned
CheckPointer

Pointer checks

You are responsible for fill this function completely with implementation code. Refer to the help page for “POU ‘CheckPointer’”. This function should monitor whether the returned pointer references a valid memory address; monitors whether the orientation of the referenced memory range matches the variable type that the pointer refers to. If both conditions are fulfilled, then the pointer is returned. If not, then CheckPointer should complete an appropriate error handling. CheckPointer monitors the same way as variables of type REFERENCE TO.

See also