2-821
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
SD Memory Card Instructions
2
FileWrite
• If WriteBuf[] is an array of structures, adjustment areas between members may be inserted depend-
ing on the composition.
• If the operating mode of the CPU Unit is changed to PROGRAM mode or when a major fault level
Controller error occurs during instruction execution, the file is closed by the system. Any read/write
operations that are in progress are completed to the end.
• An error occurs in the following cases. Error will change to TRUE.
• The number of array elements in WriteBuf[] is smaller than the value of Size.
• The SD Memory Card is not in a usable condition.
• The SD Memory Card is write protected.
• There is insufficient space available on the SD Memory Card.
• The file specified by FileID does not exist.
• The file specified by FileID is being accessed.
• The file specified by FileID was not opened in a writing mode.
• An error that prevents access occurs during SD Memory Card access.
Here, four bytes of data are written from the second byte from the beginning of the file 'ABC.bin.' The
contents of the BYTE array variable OutDat[] is written to the file. The processing procedure is as fol-
lows:
1
The FileOpen instruction is used to open the file ‘ABC.bin.’
2
The FileSeek instruction is used to set a file position indicator at the second byte from the begin-
ning of the file.
3
The FileWrite instruction is used to write four bytes from array variable OutDat[] to the position of
the file position indicator.
4
The FileClose instruction is used to close the file ‘ABC.bin.’
Sample Programming