Runtime Controller Configuration and Status
To access most controller configuration and status in logic, use the Get System Value (GSV) and Set System Value (SSV) instructions. Access a set of status and arithmetic flags directly in relay instruction operands. These flags are not tags and you cannot create aliases to them.
S:FS
First Scan flag
The first scan flag is set by the controller on the first scan of the routines in this program. Use this flag with only the XIC and XIO instructions to initialize data for use in later scans.
S:N
Negative flag
The controller sets the negative flag when the result of an arithmetic or logical operation is a negative value. Use this flag only with the XIC, XIO, OTE, OTL and OTU instructions as a quick test for a negative value. Using S:N is more efficient than using the CMP instruction.
S:Z
Zero flag
The zero flag is set by the controller when the result of an arithmetic or logical operation is zero. Use this flag only with the XIC, XIO, OTE, OTL and OTU instructions as a quick test for a zero value. Using S:Z is more efficient than using the CMP instruction.
S:V
Overflow flag
The controller sets the overflow flag when the result of an arithmetic operation resulted in an overflow. Use this flag only with the XIC, XIO, OTE, OTL and OTU instructions to check that the result of an operation is still in range. For example, adding 1 to a SINT generates an overflow when the value goes from 127 to 128. A SINT is an atomic data type that stores an 8-bit signed integer value (-128 to +127).
TIP:
Setting the overflow flag causes the controller to generate a minor fault. A minor faults is a controller fault that does not stop execution in the controller nor transitions to Fault mode. Examples of minor faults are a watchdog triggered on a task or a low battery.
S:C
Carry flag
The controller sets the carry flag when an arithmetic operation resulted in the generation of a carry out of the most significant bit. Use this flag only with the XIC, XIO, OTE and OTL instructions for performing 64-bit integer math operations.
S:MINOR
Minor Fault flag
The controller sets the minor fault flag when there is at least one minor program fault. Use this flag only with the XIC, XIO, OTE, OTL and OTU instructions to test that a minor fault has occurred and take appropriate action.
Provide Feedback