Summary
Copies device memory in one operation. Data for the number of Addresses is copied to the copy destination Word Addresses beginning from the source data's first Word Address. The number of addresses that can be used is from 1 to 640.
Format
memcpy (Copy destination address, Copy source address, Number of words)
Example expression:
memcpy ([w:[PLC1]D0200], [w:[PLC1]D0100], 10)
In the above example, data is copied from D0100 to D0109 to D0200 to D0209.
Source copy data is read from the connected device only once, when required. If a communication error occurs during data read, the display unit's internal special relay LS2032's Bit 12 is turned ON. When data read is completed normally, Bit 12 is OFF.
Reading from the source copy data and writing the data to the destination is performed in one operation, or it is accomplished by dividing the data into several items equivalent to the number of Addresses used for the source copy data. If a communication error occurs during data read, the result of the data copy varies as follows, depending on whether the data was processed in one operation or in several items: (Result of data write operation O: Write complete, X: Unable to write)
As the number of Addresses increases, more time is required for writing data to the PLC. Depending on the number of Addresses, it may take from 20 seconds to several minutes.
If data to be written exceeds the designated address range, a communication error occurs. In this case, you must turn OFF then ON the GP to reset the GP from the error.
When data is written to the LS Area with the Copy Memory function (memcpy), the data is written only to the User area. Data cannot be written into the System Data area (LS0000 to LS0019), Special area (LS2032 to S2047), or Reserved area (LS2048 to LS2095). However, you can read data from these areas.
When using D-Script to copy 32-bit device data to a 16-bit device, and the bit length is designated as 16 bits, only data in the lower 16 bits will be copied.
For example, memcpy ([w:[PLC1]w30.0100], [w:[PLC1]BD0100], 3)
Also, when 16 bit device data is copied to a 32 bit device, data is copied to the bottom 16 bits and "0" is set for the top 16 bits.
For example, memcpy ([w:[PLC1]BD0100], [w:[PLC1]w30.0100], 3)
When 32-bit device data is copied to a 16-bit device, or when 16-bit device data is copied to a 32-bit device, and the D-Script bit length defined in the script is 32 bits, the copy operation works as follows. When one of the devices is a 32-bit device and the other is a 16-bit device, the memcpy ( ) function will use 16 bits as its data length parameter.
For example, memcpy ([w:[PLC1]w30.0100], [w:[PLC1]BD0100], 4)
For example, memcpy ([w:[PLC1]BD0100], [w:[PLC1]w30.0100], 4)
If the original and destination data ranges overlap, all overlapping data will be rewritten as follows.
For example, when copying D101-D104 to D100-D103
Data is copied beginning with address 0 (smaller address).
For example, when copying D100-D103 to D101-D104
Data is copied beginning with the last address (larger address).
Although this example's function designates 2 Addresses, these Addresses will not be counted as D-Script Addresses.
When using a device address for assignment, communication with the device/PLC causes a slight delay in assigning the value.