Skip to main content

Subtract Date

Instruction Parameters

Supported PLC Series

XPnA/1RXPnBXPnEXPnFCP3A/B/P/U
CP4A~D/U
CPnECPnFBPPLC-S

Supported Data Registers

MXYKLFTCSZRQD@DConstant
S1--
S2--
D-----

Supported Flags

FlagBitSupport
ErrorF11.0
ZeroF11.1-
CarryF11.2-

Number of Steps

Steps
4

Operands

OperandDescription
S1The first operand.
Entries are WORD data registers or constants.
This requires 3 data registers.

The value range is 0 ~ 23 (hours) or 0 ~ 59 (minutes and seconds).
S2The second operand.
Entries are WORD data registers or constants.
This requires 3 data registers.

The value range is 0 ~ 23 (hours) or 0 ~ 59 (minutes and seconds).
DThe third operand.
Entries are only WORD data registers.
This is where the difference is saved.
This requires 3 data registers.

Notice

Error Flag (F11.0) Notice

The error flag, F11.0, will be ON for one scan when the address of the data register assigned by @D exceeds the range of the data register, D. The range of the data register, D, is dependent on the CPU type.

F11.0 turns ON when the value of the data for subtracting exceeds the data register assigned to S1 or S2.

Instruction Behavior

The DATE+ and** DATE+P** instructions behave as follows:

  • The value of S1 and S2 should follow this format:
    • Hour: 0 ~ 23
    • Minute: 0 ~ 59
    • Second: 0 ~ 59
    • The sum will be saved in the same format starting at the data register D.
  • If the sum of S1 + S2 exceeds 24 hours, 24 hours will be added from the difference.
Tip: Operand Subtraction Format

S2 is subtracted from S1.
(S1 - S2)

Examples