FREAD
FREAD
FREAD instruction copies a specified system memory of the special module and saves the result in the Destination.
(It supports only in CM1-PS02A special module)
| |
n1 | Slot number of special module |
n2 | Starting system memory to be read |
D | Destination |
n3 | Number of system memory to be read |
n4 | Result of operation |
Instruction | Device address | No. of Steps | Flag | |||||||||||||||
M | X | Y | K | L | F | T | C | S | Z | D | @D | Int. |
| Error | Zero | Carry | ||
FREAD | n1 | o | o | o | o | o | o | o | o | - | o | o | o | o | 6 | o | - | - |
n2 | o | o | o | o | o | o | o | o | - | o | o | o | o | |||||
D | o | - | o | o | o | - | - | - | - | o | o | o | - | |||||
n3 | o | o | o | o | o | o | o | o | - | o | o | o | o | |||||
n4 | o | - | o | o | o | - | - | - | - | o | o | o | - |
When enabled, the FREAD copies specified number(n3) of system memory(n2) from the special module(n1: slot number of expansion module) to the Destination (D device address) and saves the result of instruction operation in the n4.
n1 : HEX that shows Base and Slot number of expansion module.
Ex) H + (Base number) + (Slot number)
Base number | Slot number | n1 |
Local Base | Slot number 5. | H0005 |
Expansion Base number 1. | Slot number 3. | H0103 |
Expansion Base number 10. | Slot number 7. | H0A07 |
Expansion Base number 14. | Slot number 12. | H0E0C |
Expansion Base number 16. | Slot number 10. | H100A |
Please refer to below the Base and Slot number system for CM1 series.
n2 : Offset that is starting address of system memory to be read.
(Please refer to System memory of positioning module)
n3 : Size (number of system memory to be read)
The range of n3 is from 0 to 32,767.
If n3 is 0, instruction will not work and if n3 is out of range, it occurs an error.
n4 : the result of instruction operation is stored in n4.
Bit No. | Description |
0 | If instruction is running (1), If instruction is completed (0) |
1 | Error |
2 – 7 | Not used |
8 - 15 | Error Code 00H : No error 01H : Maximum 32 data can be read and write at the same time for a scan 02H : Data size is out of range 03H : Wrong Offset |
The error flag is turned ON if :
a. CPU cannot access expansion module.
b. n1 is not special module (CM1-PS02A)
c. n3 exceeds Destination.
d. n3 is out of range (0 – 32,767)
Base and Slot number for CM1
Example)
If M00 is ON, the FREAD instruction copies 5words of system memory 29 from positioning module that is installed at slot no. 1 in the local base and saves its value to D0~D4 in sequence. The result of operation is stored in M00.