FileSeek

PLCopen motion icon

 Function BlockClosed A function block groups an algorithm and a set of private data. It has inputs and outputs. - Sets the current positionClosed Position means a point in space which is described by different coordinates. Depending on the used system and transformation it can consist of a maximum of six dimensions (coordinates).This means three Cartesian coordinates in space and coordinates for the orientation. In ACS there can be even more than six coordinates. If the same position is described in different coordinate systems the values of the coordinates are different. in an open file.

Inputs

Input

Data Type

Range

Unit

Default

Description

Execute

BOOL

0, 1

N/A

No default

On the rising edgeClosed The transition of a digital signal from low to high. AKA: positive edge., test if the end of the file is reached in a file that is open for reading.

ID

UDINT

N/A

N/A

No default

The ID of the open file.

POS

DINT

N/A

N/A

No default

Number of bytes to offset from ORG.

  • If ORG = SEEK_SET, then POS should be ≥ 0 (zero).
  • If ORG = SEEK_END, then POS should be ≤ 0 (zero).
  • If ORG = SEEK_CUR, then POS can be positive or negative.

ORG

DINT

  • SEEK_SET
  • SEEK_CUR
  • SEEK_END

N/A

No default

Origin of the move.

  • SEEK_SET = Beginning of the file.
  • SEEK_CUR = Current position.
  • SEEK_END = End of the file.

Outputs

Output

Data Type

Range

Unit

Description

Done

BOOL

 

 

If TRUE, the command completed successfully.

Error

BOOL

 

 

If TRUE, an error has occurred.

ErrorID

DINT

 

 

Indicates the error if Error output is TRUE.

See the table in Search IndexFile and TCP/IP Function Block ErrorIDs.

Remarks

Figure 1: FileCopy

FBD Language Example

Not available.

FFLD Language Example

Not available.

IL Language Example

Not available.

ST Language Example

(* FileSeek example *)
CASE StepCounter OF
0:
  (* Move to beginning of the file *)
  Inst_FileSeek(TRUE, MyInputFileID, 0, SEEK_SET);
  StepCounter := StepCounter + 1;
1:
  Inst_FileSeek(TRUE, MyInputFileID, 0, SEEK_SET);
  IF Inst_FileSeek.Done THEN
     Inst_FileSeek(FALSE, 0, 0, SEEK_SET);
     StepCounter := StepCounter + 1;
  END_IF;
END_CASE;

See Also