FileReadLine

PLCopen motion icon

 Function Block - Reads a string value from a text file.

FileReadLine stops reading from the file if either:

  • 255 characters are read (the maximum length of the STRING type).
  • A new line is encountered.

Inputs

Input

Data Type

See Data Types.

Range

Unit

Default

Description

Execute

BOOL

FALSE, TRUE

N/A

No default

On the rising edge, read the size of a file.

ID

UDINT

No range

N/A

No default

The ID of the open file.

Outputs

Output

Data Type

See Data Types.

Range

Unit

Description

Done

BOOL

FALSE, TRUE

N/A

If TRUE, the command completed successfully.

Error

BOOL

FALSE, TRUE

N/A

If TRUE, an error has occurred.

ErrorID

DINT

Enumerated

N/A

Value

STRING

No range

N/A

The string value read from the file.

FBD Language Example

Not available.

FFLD Language Example

Not available.

IL Language Example

Not available.

ST Language Example

(* FileReadLine example *)
CASE StepCounter OF
0:
  Inst_FileReadLine(TRUE, MyInputFileID);
  StepCounter := StepCounter + 1;
1:
  Inst_FileReadLine(TRUE, MyInputFileID);
  IF Inst_FileReadLine.Done THEN
     lineText := Inst_FileReadLine.Value;
     Inst_FileReadLine(FALSE, 0);
     StepCounter := StepCounter + 1;
  END_IF;
END_CASE;

See Also