Assignment :=

PLCopen motion icon

Operator - Variable assignment.

Inputs

Input

Data Type

Range

Unit

Default

Description

IN

ANY

 

 

 

Any variable or complex expression.

Outputs

Output

Data Type

Range

Unit

Description

Q

ANY

 

 

Forced variable.

Remarks

  • The output variable and the input expression must have the same type.
  • The forced variable cannot have the read-only attribute.
  • In the FBD and FFLD languages, the 1 block is available to perform a 1 gain data copy (1 copy).
  • In the IL Language:
    • The FFLD instruction loads the first operand.
    • The ST instruction stores the current result into a variable.
      • The current result and the operand of ST must have the same type.
  • Both FFLD and ST instructions can be modified by N in case of a Boolean operand for performing a Boolean negation.

FBD Language Example

FFLD Language Example

  • In the FFLD Language, the input rung (EN) enables the assignment.
    • The output rung keeps the state of the input rung.
  • The copy is executed only if EN is TRUE.
  • ENO has the same value as EN.

IL Language Example

Op1: FFLD  IN   (* current result is: IN *)
ST  Q    (* Q is: IN *)
FFLDN IN1  (* current result is: NOT (IN1) *)
ST  Q    (* Q is: NOT (IN1) *)
FFLD  IN2  (* current result is: IN2 *)
STN Q    (* Q is: NOT (IN2) *)

ST Language Example

Q := IN; (* copy IN into variable Q *)
Q := (IN1 + (IN2 / IN 3)) * IN4; (* assign the result of a complex expression *)
result := SIN (angle); (* assign a variable with the result of a function *)
time := MyTon.ET; (* assign a variable with an output parameter of a function block *)

See Also

Parenthesis (  )