Negate NEG
Dest = Source with its sign flipped.
NEGATE
SourceGlobal.Offset5DestGlobal.NegOffset-5
| Tag | After two scans |
|---|---|
| NegOffset | -5 |
| Offset | 5 |
How it works
While the rung is true, writes Source with its sign flipped, so 5 becomes -5. A false rung changes nothing.
How it's used
Use NEG to reverse a direction or an offset.
Global.ReverseXIO
Source300
Dest-300
Global.ReverseXIC
NEGATE
SourceGlobal.Speed300DestGlobal.Command-300
| Tag | Value |
|---|---|
| Reverse | 1 |
| Speed | 300 |
| Command | -300 |
Reverse is on, so Command is -300.
Operands
| Operand | Data type | Read or write |
|---|---|---|
| Source | DINT, REAL or a number | Reads |
| Dest | DINT, REAL | Writes |
Common mistakes
- Using the smallest DINT-2147483648 has no positive DINT, so it is a fault.