Negate (NEG)
The NEG instruction changes the sign of the Source and places the result in the Destination.
Available Languages
- Ladder Diagram
- Function Block
- Structured Text
This instruction is not available in structured text. *
* There is no equivalent structured text instruction. Use the operator in an expression.
Operands
Operands
- Ladder Diagram
- Function Block
- Structured Text
Use the minus sign "-" as an operator in an expression. This expression changes the sign of source and stores the result in dest.
dest := -source;
FBD_MATH Structure
Example
Change the sign of value_1 and place the result in negate_result.
- Ladder Diagram
- Function Block
- Structured Text
negate_result := -value_1;
File name: PLC-23_IS_CMI-NEG.pdf
File size: 408.47 KB
Available Languages
- Ladder Diagram
- Function Block
- Structured Text
This instruction is not available in structured text. *
* There is no equivalent structured text instruction. Use the operator in an expression.
Operands
Operands
- Ladder Diagram
Operand | Type | Format | Description |
Source | SINT INT DINT REAL | Immediate tag | value to negate |
Destination | SINT INT DINT REAL | tag | tag to store the result |
- Function Block
Operand | Type | Format | Description |
NEG tag | FBD_MATH_ADVANCED | structure | NEG structure |
- Structured Text
Use the minus sign "-" as an operator in an expression. This expression changes the sign of source and stores the result in dest.
dest := -source;
FBD_MATH Structure
Input Parameter | Data Type | Description |
EnableIn | BOOL | Enable input. If cleared, the instruction does not execute and outputs are not updated. Default is set. |
Source | REAL | Value to negate. Valid = any float |
Output Parameter | Data Type | Description |
EnableOut | BOOL | Enable output. |
Dest | REAL | Result of the math instruction. Arithmetic status flags are set for this output. |
Example
Change the sign of value_1 and place the result in negate_result.
- Ladder Diagram
- Function Block
- Structured Text
negate_result := -value_1;
File name: PLC-23_IS_CMI-NEG.pdf
File size: 408.47 KB
0 comments :