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 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.

Hint

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

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

Note

By default, CODESYS does not execute implicit checks for POUs from libraries. However, you can use the compiler definition CheckRangeSigned to extend the test to POUs from libraries. This affects implementation libraries (*.library) only, not protected libraries (*.compiled-library).

You can use the attribute “Uncheck” to deactivate the check for special POUs in the project.

Available functions
Monitoring function Type
Check Bounds

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