STACKINT

Manages a stack of integer values.
Arguments
PUSH
BOOL
Push command (on rising edge only)
add the IN value on the top of the stack
POP
BOOL
Pop command (on rising edge only)
delete in the stack the last value pushed (top of the stack)
R1
BOOL
Resets the stack to its empty state
IN
DINT
Pushed value
N
DINT
Application defined stack size
EMPTY
BOOL
TRUE if the stack is empty
OFLO
BOOL
Overflow: TRUE if the stack is full
OUT
DINT
Value at the top of the stack
OUT equals 0 when OFLO is TRUE
The STACKINT function block includes a rising edge detection for both PUSH and POP commands. The maximum size of the stack is 128. The application defined stack size N cannot be less than 1 or greater than 128.
This function manages invalid values as follows:
  • if N<1, STACKINT assumes a size of 1
  • if N>128, STACKINT assumes a size of 128
    TIP: The OFLO value is valid only after a reset (R1 has been set to TRUE at least once and back to FALSE).

Example

(* FBD program using the STACKINT block: error management *)
(* ST Equivalence: We suppose STACKINT1 is an instance of STACKINT block *)
STACKINT1(err_detect, acknowledge, manual_mode, err_code, max_err); appli_alarm := auto_mode AND NOT(STACKINT1.EMPTY); err_alarm := STACKINT1.OFLO; last_error := STACKINT1.OUT;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal