MOVE:移动值 |
说明
可以使用“移动值”指令,将 IN 输入处操作数中的内容传送给 OUT1 输出的操作数中。始终沿地址升序方向进行传送。
如果满足下列条件之一,使能输出 ENO 将返回信号状态“0”:
- 使能输入 EN 的信号状态为“0”。
- IN 参数的数据类型与 OUT1 参数的指定数据类型不对应。
下表列出了可用于 S7-1200 CPU 系列的传送:
传送源 (IN) | 传送目标 (OUT1) | |
进行 IEC 检查 | 不进行 IEC 检查 | |
BYTE | BYTE、WORD、DWORD | BYTE、WORD、DWORD、SINT、USINT、INT、UINT、DINT、UDINT、TIME、DATE、TOD、CHAR |
WORD | WORD、DWORD | BYTE、WORD、DWORD、SINT、USINT、INT、UINT、DINT、UDINT、TIME、DATE、TOD、CHAR |
DWORD | DWORD | BYTE、WORD、DWORD、SINT、USINT、INT、UINT、DINT、UDINT、REAL、TIME、DATE、TOD、CHAR |
SINT | SINT | BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, TIME, DATE, TOD |
USINT | USINT, UINT, UDINT | BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, TIME, DATE, TOD |
INT | INT | BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, TIME, DATE, TOD |
UINT | UINT, UDINT | BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, TIME, DATE, TOD |
DINT | DINT | BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, TIME, DATE, TOD |
UDINT | UDINT | BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, TIME, DATE, TOD |
REAL | REAL | DWORD, REAL |
LREAL | LREAL | LREAL |
TIME | TIME | BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, TIME |
DATE | DATE | BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, DATE |
TOD | TOD | BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, TOD |
DTL | DTL | DTL |
CHAR | CHAR | BYTE, WORD, DWORD,CHAR,字符串中的字符1) |
WCHAR | WCHAR | BYTE,WORD,DWORD,CHAR,WCHAR,字符串中的字符1) |
字符串中的字符1) | 字符串中的字符 | CHAR,WCHAR,字符串中的字符 |
ARRAY 2) | ARRAY | ARRAY |
STRUCT | STRUCT | STRUCT |
PLC 数据类型 (UDT) | PLC 数据类型 (UDT) | PLC 数据类型 (UDT) |
IEC_TIMER | IEC_TIMER | IEC_TIMER |
IEC_SCOUNTER | IEC_SCOUNTER | IEC_SCOUNTER |
IEC_USCOUNTER | IEC_USCOUNTER | IEC_USCOUNTER |
IEC_COUNTER | IEC_COUNTER | IEC_COUNTER |
IEC_UCOUNTER | IEC_UCOUNTER | IEC_UCOUNTER |
IEC_DCOUNTER | IEC_DCOUNTER | IEC_DCOUNTER |
IEC_UDCOUNTER | IEC_UDCOUNTER | IEC_UDCOUNTER |
下表列出了可用于 S7-1500 CPU 系列的传送:
传送源 (IN) | 传送目标 (OUT1) | |
进行 IEC 检查 | 不进行 IEC 检查 | |
BYTE | BYTE, WORD, DWORD, LWORD | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, TIME, LTIME, LDT, DATE ,TOD, LTOD, CHAR |
WORD | WORD, DWORD, LWORD | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, S5TIME, TIME, LTIME, LDT, DATE, TOD, LTOD, CHAR |
DWORD | DWORD, LWORD | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, REAL, TIME, LTIME, LDT, DATE, TOD, LTOD, CHAR |
LWORD | LWORD | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, LREAL, TIME, LTIME, LDT, DATE, TOD, LTOD, CHAR |
SINT | SINT | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, TIME, LTIME, LDT, DATE, TOD, LTOD |
USINT | USINT, UINT, UDINT, ULINT | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, TIME, LTIME, LDT, DATE, TOD, LTOD |
INT | INT | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, TIME, LTIME, LDT, DATE, TOD, LTOD |
UINT | UINT, UDINT, ULINT | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, TIME, LTIME, LDT, DATE, TOD. LTOD |
DINT | DINT | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, TIME, LTIME, LDT, DATE, TOD, LTOD |
UDINT | UDINT, ULINT | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, TIME, LTIME, LDT, DATE, TOD, LTOD |
LINT | LINT | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, TIME, LTIME, LDT, DATE, TOD, LTOD |
ULINT | ULINT | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, TIME, LTIME, LDT, DATE, TOD, LTOD |
REAL | REAL | DWORD, REAL |
LREAL | LREAL | LWORD, LREAL |
S5TIME | S5TIME | WORD, S5TIME |
TIME | TIME | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, TIME |
LTIME | LTIME | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, LTIME |
DATE | DATE | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, DATE |
DT | DT | DT |
LDT | LDT | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, LDT |
TOD | TOD | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, TOD |
LTOD | LTOD | BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, LTOD |
DTL | DTL | DTL |
CHAR | CHAR | BYTE, WORD, DWORD, LWORD,CHAR,字符串中的字符1) |
WCHAR | WCHAR | BYTE,WORD,DWORD,LWORD,CHAR,WCHAR,字符串中的字符1) |
字符串中的字符1) | 字符串中的字符 | CHAR,WCHAR,字符串中的字符 |
ARRAY 2) | ARRAY | ARRAY |
STRUCT | STRUCT | STRUCT |
COUNTER | COUNTER, WORD, INT | WORD、DWORD、INT、UINT、DINT、UDINT |
TIMER | TIMER, WORD, INT | WORD、DWORD、INT、UINT、DINT、UDINT |
PLC 数据类型 (UDT) | PLC 数据类型 (UDT) | PLC 数据类型 (UDT) |
IEC_TIMER | IEC_TIMER | IEC_TIMER |
IEC_LTIMER | IEC_LTIMER | IEC_LTIMER |
IEC_SCOUNTER | IEC_SCOUNTER | IEC_SCOUNTER |
IEC_USCOUNTER | IEC_USCOUNTER | IEC_USCOUNTER |
IEC_COUNTER | IEC_COUNTER | IEC_COUNTER |
IEC_UCOUNTER | IEC_UCOUNTER | IEC_UCOUNTER |
IEC_DCOUNTER | IEC_DCOUNTER | IEC_DCOUNTER |
IEC_UDCOUNTER | IEC_UDCOUNTER | IEC_UDCOUNTER |
IEC_LCOUNTER | IEC_LCOUNTER | IEC_LCOUNTER |
IEC_ULCOUNTER | IEC_ULCOUNTER | IEC_ULCOUNTER |
REF() | 不进行数据类型转换。所传递变量的数据类型必须与指定数据类型完全匹配。 |
1) 还可以使用“移动值”指令将字符串的各个字符传送到数据类型为 CHAR 或 WCHAR 的操作数。操作数名称旁的方括号内指定了要传送的字符数。例如,“MyString[2]”将传送“MyString”字符串的第二个字符。它还可以将数据类型为 CHAR 或 WCHAR 的操作数传送到字符串的各个字符中。还可使用其它字符串的字符来替换该字符串中的指定字符。
2) 仅当输入 IN 和输出 OUT1 中操作数的数组元素为同一数据类型时,才可以传送整个数组 (ARRAY)。
如果输入 IN 数据类型的位长度超出输出 OUT1 数据类型的位长度,则源值的高位会丢失。如果输入 IN 数据类型的位长度低于输出 OUT1 数据类型的位长度,则目标值的高位会被改写为 0。
在初始状态,指令框中包含 1 个输出 (OUT1)。可以扩展输出数目。在该指令框中,应按升序顺序排列所添加的输出。在执行指令过程中,将输入 IN 的操作数的内容传送到所有可用的输出。如果传送结构化数据类型(DTL、STRUCT、ARRAY)或字符串的字符,则无法扩展指令框。
还可以使用“块移动” (MOVE_BLK) 和“不可中断的存储区移动” (UMOVE_BLK) 指令移动 ARRAY 数据类型的操作数。可以使用“移动字符串”(S_MOVE) 指令复制 STRING 或 WSTRING 数据类型的操作数。
参数
下表列出了“移动值”指令的参数:
参数 | 声明 | 数据类型 | 存储区 | 说明 | |
S7-1200 | S7-1500 | ||||
EN | Input | BOOL | BOOL | I、Q、M、D、L 或常量 | 使能输入 |
ENO | Output | BOOL | BOOL | I、Q、M、D、L | 使能输出 |
IN | Input | 位字符串、整数、浮点数、定时器、日期时间、CHAR、WCHAR、STRUCT、ARRAY、IEC 数据类型、PLC 数据类型 (UDT) | 位字符串、整数、浮点数、定时器、日期时间、CHAR、WCHAR、STRUCT、ARRAY、TIMER、COUNTER、IEC 数据类型、PLC 数据类型 (UDT) | I、Q、M、D、L 或常量 | 源值 |
OUT1 | Output | 位字符串、整数、浮点数、定时器、日期时间、CHAR、WCHAR、STRUCT、ARRAY、IEC 数据类型、PLC 数据类型 (UDT) | 位字符串、整数、浮点数、定时器、日期时间、CHAR、WCHAR、STRUCT、ARRAY、TIMER、COUNTER、IEC 数据类型、PLC 数据类型 (UDT) | I、Q、M、D、L | 传送源值中的操作数。 |
有关有效数据类型的更多信息,请参见“另请参见”。
示例
以下示例说明了该指令的工作原理:
下表将通过具体的操作数值对该指令的工作原理进行说明:
参数 | 操作数 | 值 |
IN | TagIn_Value | 0011 1111 1010 1111 |
OUT1 | TagOut_Value | 0011 1111 1010 1111 |
如果操作数“TagIn”返回信号状态“1”,则执行该指令。该指令将操作数“TagIn_Value”的内容复制到操作数“TagOut_Value”,并将“TagOut”的信号状态置位为“1”。