2-827
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
SD Memory Card Instructions
2
FileGets
The following figure shows a programming example. Here, a text string of one line is read from a file, the
line feed code is deleted, and the result is written to pqr.
• Execution of this instruction is continued until processing is completed even if the value of Execute
changes to FALSE or the execution time exceeds the task period. The value of Done changes to
TRUE when processing is completed. Use this to confirm normal completion of processing.
• Refer to Using this Section on page 2-2 for a timing chart for Execute, Done, Busy, and Error.
• If the length of the one-line text string exceeds 1,986 bytes (with UTF-8 character codes, including
the final NULL character), the first 1,985 bytes of the text string are stored in Out with a NULL charac-
ter attached.
Related System-defined Variables
Name Meaning Data type Description
_Card1Ready SD Memory Card
Ready Flag
BOOL This flag indicates if the SD Memory Card is
physically inserted and is mounted normally,
i.e., if it can be accessed by instructions and
communications commands.
TRUE: Can be used.
FALSE: Cannot be used.
_Card1Protect SD Memory Card Write
Protected Flag
BOOL This flag indicates if the SD Memory Card is
write protected when it is inserted and ready to
use.
TRUE: Write protected.
FALSE: Not write protected.
_Card1Err SD Memory Card Error
Flag
BOOL This flag indicates if an unspecified SD Memory
Card (e.g., an SDHC card) is mounted or if the
format is incorrect (i.e., not FAT16 or cor-
rupted).
TRUE: Error.
FALSE: No error.
_Card1Access SD Memory Card
Access Flag
BOOL This flag indicates if the SD Memory Card is
currently being accessed.
TRUE: Being accessed.
FALSE: Not being accessed.
_Card1PowerFail SD Memory Card
Power Interruption Flag
BOOL This flag indicates if an error occurred in com-
pleting processing when power was interrupted
during SD Memory Card access. This flag is
not cleared automatically.
TRUE: Error.
FALSE: No error.
Precautions for Correct Use
FileGets_instance(A, abc, TRUE, def, ghi,
jkl, mno, pqr, stu);
LD ST
abc
ghi
jkl
mno
pqr
stu
def
TRUE
A
FileGets
Execute Done
FileID Busy
TrimLF Error
ErrorID
Out
EOF
FileGets_instance