Type
| Function block |
Description
| Determines the current position of the file pointer in a file.In order to determine the current position of the file pointer (relative offset from start of file), the valid handle for the file is assigned to Handle. This handle is created when the file is opened with the FILE_OPEN function block.Activate the function block on a rising edge at the Execute input. Execution of the function block is complete when the Done output is set to 1. The current position of the file pointer can be read at the Position output following successful execution.If an error occurred during execution, the value at the Error output = 1. ErrorID indicates the number of the cause of the error. |
Notes
|
- The status of the Done, Position, Error, and ErrorID outputs is maintained until a falling edge is detected at the Execute input.
- Function blocks have to be instantiated. The instance name of the function block has to be declared in the 'Variables' table of the POU where the FB is going to be used. The instance name must be unique within the POU.
|
Parameters
| Inputs
Execute
Data type: | BOOL |
Description: | Determines the current position of the file pointer if a rising edge is detected. |
Handle
Data type: | UINT |
Description: | File handle of the file whose position is to be determined. |
Outputs
Done
Data type: | BOOL |
Description: |
0 | The function block was not executed. |
1 | The function block was executed. |
|
Position
Data type: | DINT |
Description: | Current position in the file. |
Error
Data type: | BOOL |
Description: |
0 | No error occurred when determining the position. |
1 | An error occurred when determining the position. |
|
ErrorID
Data type: | UINT |
Description: | Error number of the error that occurred when determining the position:
0 | No error information available. |
1 | Invalid file handle. |
|
|