This instruction allows a portion of memory of specified length to be copied from a source location to a destination location.
Syntax |
move_mem (sorg, dest, num) |
---|---|
sorg |
It is the variable from which you intend to start copying. It cannot be a mathematical expression. It can be an integer, real or string register, or a local integer, real or string variable |
dest |
It is the variable from whose location the recopied block of memory is downloaded. It cannot be a mathematical expression. It can be an integer, real or string register, or an integer, real or string local variable. In the case of registers, the copying is extended to the registers following the one specified as the destination. In the case of local variables, which will typically have at least one index, care must be taken not to attempt to transfer more than the declared size of the destination variable. Failure to do so will result in an appropriate error message during program execution. This check is performed only in the case where dest is a local variable |
num |
It is the number of elements to be copied. It can be a mathematical expression. The number num does not represent a number of bytes, but a number of elements; e.g., in the case of real variables, if you specify num = 5, five consecutive real locations of the specified variable will be copied (in total, 40 bytes). The type of the variable will be the same as the type of sorg |
Validity |
Rule, Task |
Note |
The system does not guarantee atomicity of the buffer. Special care must be taken if the data moved may be changed by multiple tasks at different priorities |
In the case of strings, the character 0 (string terminator) is copied only if it is included in the number of characters whose copying is requested. Consequently, to transfer the string "hello" entirely, a move_mem with num = 5 must be performed.
Example of use:
|