3. Instructions
996
CS/CJ/NSJ Series Instructions Reference Manual (W474)
TWRIT
Applicable Program Areas
Operands
C: Control Word
• #0000: Append file.
• #0001: Create new file or overwrite.
S1: Number of write bytes
Specifies the number of bytes to write in the range 0 to 255 decimal or 0000 to 00FF hexadecimal.
S2: First directory/filename word
• Specifies the first word of the words containing the file's directory path and filename. Input the path
and filename in ASCII text.
• Directory name:
The directory name can be 1 to 65 characters long. If the name is less than 65 characters, do not pad
with spaces. Specify the absolute path from the root directory's \ (#5C) character.
• Filename:
Filename identifier: The identifier can be 1 to 8 characters long. If the name is less than 8 characters,
do not pad with spaces. Add a NUL character (#00) at the end of the filename. (The NUL character is
not included as one of the 8 characters.)
• Filename extension: None
• Separate the directory name and filename with a \ (#5C) delimiter.
Note The words containing the directory path and filename (starting at S2) must be in the same data area.
Instruction Mnemonic Variations
Function
code
Function
WRITE TEXT FILE TWRIT @TWRIT 704
Reads ASCII data from I/O memory and stores that
data in the Memory Card as a text file (writing a new
file or appending a file).
Symbol
TWRIT
Area
Function block
definitions
Block program areas Step program areas Subroutines Interrupt tasks
SFC action or
transition programs
Usage OK OK OK OK OK OK
Operand Description Data type Size
C Control word UINT 1
S1 Number of bytes to write UINT 1
S2 Directory and file name WORD 1
S3 Write data WORD 1
S4 Delimiter WORD 1
TWRIT(704)
C
S1
S2
S3
S4
C: Control word
S1: Number of bytes to write
S2: Directory and file name
S3: Write data
S4: Delimiter
S2
S2+1
S2+38
S1+2
F1
F3
:
F73
F2
F4
:
F74
Store the character string beginning with the leftmost byte in S2, in the order
leftmost byte → rightmost byte and lower word address → higher word address.
The directory name and filename can be up to 74 bytes long, including the
NULL (00 Hex) at the end of the filename.