Write File Data
Instruction Parameters
Supported PLC Series
| XPnA/1R | XPnB | XPnE | XPnF | CP3A/B/P/U CP4A~D/U | CPnE | CPnF | BP | PLC-S |
|---|---|---|---|---|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
Supported Module
Only the CM1-PS02A module is supported for this instruction.
Supported Data Registers
| M | X | Y | K | L | F | T | C | S | Z | R | Q | D | @D | Constant | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| n1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| n2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| S | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - | - | ✓ | - | ✓ | ✓ | ✓ | - |
| n3 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| n4 | ✓ | - | ✓ | ✓ | ✓ | - | - | - | - | - | - | ✓ | ✓ | ✓ | - |
Supported Flags
| Flag | Bit | Support |
|---|---|---|
| Error | F11.0 | ✓ |
| Zero | F11.1 | - |
| Carry | F11.2 | - |
Number of Steps
| Steps |
|---|
| 6 |
Operands
| Operand | Description |
|---|---|
| n1 | The first operand. Entries are Hexadecimal data registers or constants. This is the base and slot number of the expansion module to write to. |
| n2 | The second operand. Entries are WORD data registers or constants. This is the offset to write to. The offset depends on the file being written. |
| S | The third operand. Entries are only WORD data registers. This is where the file data to write is stored. This requires n3 data registers. |
| n3 | The fourth operand. Entries are WORD data registers or constants. This is the amount of WORD data to write. The value range is 0 ~ 255. |
| n4 | The fifth operand. Entries are only WORD data registers. This is the result of the write operation. |
Assignment Example
The following example shows how to assign values to n1 and Base/Slot.
n1
| Base Number | Slot Number | |
|---|---|---|
| H | 0A | 0B |
| Hexadecimal | 2 Digits in Hexadecimal | 2 Digits in Hexadecimal |
Base/Slot (CM1)
| Base Number | Slot | Example |
|---|---|---|
| Local Base | Slot Number 5 | H0005 or 5 |
| 1st Expansion | Slot Number 3 | H0103 |
| 10th Expansion | Slot Number 7 | H0A07 |
| 14th Expansion | Slot Number 12 | H0E0C |
| 16th Expansion | Slot Number 10 | H100A |
- If Base Number is assigned to HFF, it means file.
- If Base Number is assigned to HFF, assign PID of the file at Slot Number.
n4 Format After Execution
| Bit Number | Description |
|---|---|
| Bit 0 | 0: Operation Complete 1: Operating Instruction |
| Bit 1 | Operation Error |
| Bit 2 ~ 7 | Not used |
| Bit 8 ~ 15 | Error Code: H00: No error H01: Capacity of 1 scan process is exceeded. Maximum 32 file read operations possible per 1 scan. H02: D area overflowed. H03: n3 (offset) assignment error. |
Notice
Error Flag (F11.0) Notice
The error flag, F11.0, will be ON for one scan when the address of the data register assigned by @D exceeds the range of the data register, D. The range of the data register, D, is dependent on the CPU type.
F11.0 turns ON if access to the expansion module fails.
F11.0 turns ON if the base and slot number assigned to n1 is not an expansion module.
F11.0 turns ON if the offset of the file data assigned to n3 exceeds the range of 0 ~ 255.
Instruction Behavior
The TEST and TESTP instructions behave as follows:
- The value, S2, is value from 0 ~ 15.
- If the value, S2, is greater than 15, the remainder of S2 ÷ 16 is the equivalent.
- Example: if S2 = 17, the remainder is 1. This is the same as S2 = 1.
- If the value, S2, is greater than 15, the remainder of S2 ÷ 16 is the equivalent.
- If the BOOL data register, D, is 0, the status of the BOOL data register, D, is OFF.
- If the BOOL data register, D, is 1, the status of the BOOL data register, D, is ON.