2-819
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
SD Memory Card Instructions
2
FileWrite
FileWrite
The FileWrite instruction writes data to the specified file in the SD Memory Card.
* If you omit the input parameter, the default value is not applied. A compiling error will occur.
The FileWrite instruction writes data to the position of the file position indicator in the file specified by
file ID FileID in the SD Memory Card. The file position indicator is set at the desired location in advance
with the FileSeek instruction. The contents of the write buffer WriteBuf[] is written to the file. The
amount of data that is written is the size of the data type of WriteBuf[] times Size. You can specify an
array of enumerations or structures for WriteBuf[]. The data size that is actually written is output to
WriteSize.
Instruction Name FB/FUN Graphic expression ST expression
FileWrite Write File FB FileWrite_instance(Exe-
cute, FileID, WriteBuf, Size,
Done, Busy, Error, ErrorID,
WriteSize);
Variables
Name Meaning I/O Description Valid range Unit Default
FileID File ID
Input
ID of file to write
Depends on data type.
---
0
WriteBuf[]
(array)
Write buffer Write data *
Size Number of
elements to
write
Number of elements to write 1
WriteSize Number of
written ele-
ments
Output Number of elements that
were actually written
Depends on data type.
--- ---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
FileID OK
WriteBuf[]
(array)
OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
Arrays of enumerations or structures can also be specified.
Size OK
WriteSize OK
Function
FileWrite
Execute Done
FileID Busy
WriteBuf Error
Size ErrorID
WriteSize
FileWrite_instance