569
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Table Data Processing Instructions
3
SWRIT
z Operand Specifications
Flags
Function
SWRIT(640) overwrites the data in the desired word with the data specified in S. The location of the
desired word is calculated by subtracting the offset value in C from the stack pointer (TB+3 and TB+2).
SWRIT(640) does not change the stack pointer. The stack must be defined in advance with SSET(630).
Hint
SWRIT(640) can be used to change the data for an item currently on a conveyor. The position of the
desired item is simply the number of items back (the offset value) from the most recent item added to
the conveyor.
Area
Word addresses
Indirect DM/EM
addresses
Con-
stants
Registers Flags
Pulse
bits
TR
bits
CIO WR HR AR T C DM EM
@DM
@EM
*DM
*EM
DR IR
Indirect
using IR
TK CF
TB
OK OK OK OK OK OK OK OK OK OK
--- ---
--- OK --- --- --- ---C
OK OK
S
Name Label Operation
Error Flag P_ER • ON if the specified write location is not within the stack area.
• ON if the offset value specified in C is 0 or greater than the maximum data region size (FFFB hex).
• ON if the contents of the stack pointer (TB+3 and TB+2) is less than or equal to the PLC memory
address of first word in the data region of the stack (TB+4). (This is a stack under flow error.)
• OFF in all other cases.
A
S
B
C
D
TB
TB+1
TB+2
TB+3
TB+4
m
n
A
C
D
TB
TB+1
TB+2
TB+3
TB+4
m
n
C
n
m
n
m
PLC memory
address
Pointer
Overwrites the data in the desired
word with the data in S.
The address of the desired word is
calculated by subtracting the offset
value from the stack pointer address.
Last word
in stack
Stack
Offset value
Writes the data (A) without
changing the stack pointer.
Pointer
Stack
Last word
in stack