MOVE — Copy a Value
MOVE
Source
source
Dest
dest
Copies a source value (literal or tag) into a destination tag.
Operands
| Name | Type |
|---|---|
source | DINT | REAL |
dest | DINT | REAL |
How It Works
When the rung is true, source is read and written to dest every scan. When the rung is false, MOVE does nothing and dest keeps its last value.
Example — Change a Timer Preset at Run Time
Set a timer's preset based on which mode the machine is in.
XIC(ModeFast)MOVE(2000,CycleTimer.PRE);XIC(ModeSlow)MOVE(8000,CycleTimer.PRE)
While ModeFast is selected, CycleTimer.PRE is held at 2000. While ModeSlow is selected, it is held at 8000.
Example — Copy a Reading
XIC(SampleNow)MOVE(TempSensor,LastSample)
Common Mistakes
- Moving a
REALinto aDINTdestination without expecting truncation — the fractional part is lost.
Related
- Compare instructions — inspect values rather than move them
- Math instructions — compute values, then
MOVEor assign directly