FileOpenA

PLCopen motion icon

 Function Block - Create or open a file in append mode.

Files must be closed using the FileClose function block.


  • The controller allows only 32 open files at any given time.

Inputs

Input

Data Type

See Data Types.

Range

Unit

Default

Description

Execute

BOOL

FALSE, TRUE

N/A

No default

On the rising edge, request to open a file.

Path

STRING

No range

N/A

No default

The path to the 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

ID

UDINT

No range

N/A

The ID of the open file.

FBD Language Example

Not available.

FFLD Language Example

Not available.

IL Language Example

Not available.

ST Language Example

(* FileOpenW example *)
(* Replace FileOpenW with FileOpenA or FileOpenR as needed*)
CASE StepCounter OF
0:
  Inst_FileOpenW(TRUE, 'Results.txt');
  StepCounter := StepCounter + 1;
1:
  Inst_FileOpenW(TRUE, 'Results.txt');
  IF Inst_FileOpenW.Done THEN
     ResultsFileID := Inst_FileOpenW.ID;
     Inst_FileOpenW(FALSE, '');
     StepCounter := StepCounter + 1;
  END_IF;
END_CASE;

See Also