last
Short summary
This property returns the last step of the cycle manager, useful for error steps.
Purpose and usage
This property provides the last executed step number of the cycle manager, primarily used for error handling and recovery operations. It allows returning to the previous step for retry operations or error recovery procedures.
The property is read-only and returns the last step as a DINT value.
return DINT: Last executed step number of the cycle manager
Typical usage patterns
- Error recovery: Returning to previous step after error handling
- Retry operations: Going back one step to retry failed operations
- Step debugging: Tracking step transitions for debugging purposes
- Conditional branching: Making decisions based on where the error occurred
When to use
- In error handling steps to implement retry logic
- When you need to return to the previous step after error resolution
- For debugging step transitions and sequence flow
- In timeout handling to retry the previous operation
Example:
// Error handling with retry logic
TIMEOUT_STEP_FOR_RETRY:
cM.steps.next := cM.steps.last - 1; // Go back to previous step
cM.waitFor(ACK);
// Error step with conditional recovery
DefaultSteps.STEP.ERROR:
IF retry_counter \< MAX_RETRIES THEN
retry_counter := retry_counter + 1;
cM.steps.next := cM.steps.last; // Retry the failed step
ELSE
cM.steps.next := DefaultSteps.STEP.ABORT; // Give up after max retries
END_IF;
// Step transition logging
logger.logStepTransition(cM.steps.last, cM.steps.current);
- Type:
DINT - Getter:
public
Code
Declaration
PROPERTY last :DINT