MAX_HOLD block
Short summary
Name |
MAX_HOLD |
→POU type |
|
Category |
|
Conform to →IEC-standard |
not defined in IEC-standard |
Graphical interface |
|
Available since |
version 1.43.0 (for logi.CAD 3) |
Functionality
The block is a peak detector which sets the output OUT to the maximum value assigned to the input IN. Setting the input R to the value TRUE (or an equivalent) resets the output value OUT to the current input value IN.
Restrictions
The following restrictions apply to the usage of overloadable function block instances:
The declaration is limited to local variables.
The usage as array base type is not allowed.
The usage as structure element is not allowed.
Instance data cannot be displayed in the Values of Variables view.
In-/outputs
|
Identifier |
Description |
|
Inputs: |
IN |
REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT |
input value |
R |
BOOL |
reset |
|
Outputs: |
OUT |
REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT |
maximum value |
Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.
See:
"Blocks for safe logic" whether this block is supported for developing safety-relevant applications.
"Highlighting safe logic in the FBD-editor" for the effects when using the block as a block for safe logic .
Example for usage within ST-editor
FUNCTION_BLOCK ExampleMaxHold
VAR
iMaxHold : MAX_HOLD;
inputValues : ARRAY[1..3] OF INT := [1,10,5];
resultValues : ARRAY[1..3] OF INT;
index : INT;
END_VAR
iMaxHold(IN:=0, R:=TRUE); // Reset 'OUT' to '0'.
FOR index := 1 TO 3 DO
iMaxHold(IN:=inputValues[index], R := FALSE, OUT => resultValues[index]);
END_FOR;
// 'resultValues' evaluates to '[1,10,10]'.
ENO := AND (resultValues[1] = 1, resultValues[2] = 10, resultValues[3] = 10);
END_FUNCTION_BLOCK
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.