You can add these special POUs to an application to provide them with implicit monitoring functions. At runtime, these functions check the limits of arrays or subrange types, the validity of pointer addresses, and division by zero. Note: This option can be disabled for devices that are already equipped with these kinds of monitoring blocks by a special implicit library.
The command is used to add it to the application. The command opens the Add POU for Implicit Checks dialog where you can select a monitoring function type (see table below). Depending on the monitoring function, you have to edit 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.
For more information, see: Using POUs for Implicit Checks
|
Important |
|---|---|
|
To get 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 (example: |
|
Tip |
|---|---|
|
By default, CODESYS does not run implicit checks for function blocks from libraries used in the application. However, you can extend the check to the libraries by opening the Properties dialog of the application and specifying the compiler definition You can use the "no_check" attribute to deactivate the check for special POUs in the project. |
Table 62. Available Functions
|
Monitoring function |
Type |
|---|---|
|
Bound Checks Appropriate handling of bound violations; such handling includes setting flags or changing field indices |
|
|
Division checks: Monitors the divisor value to avoid division by zero |
|
|
Range checks: Monitors the range limit of a subrange type in runtime mode Valid for data types |
|
|
L-range checks: Monitors the range limit of a subrange type in runtime mode Valid for data types |
|
|
Pointer checks You are responsible for filling in this function completely with implementation code. See the help page for "POU 'CheckPointer'". The function should monitor whether or not the passed pointer references a valid memory address, and whether or not the orientation of the referenced memory area matches the variable type to which the pointer refers. If both conditions are fulfilled, then the pointer is returned. If not, then |