-

FILE_CLOSE

Type Function block
Description Closes a file in the parameterization memory that has been opened using the FILE_OPEN function block.

Assign the valid handle of an open file to the Handle input. With a rising edge at the Execute input the file is closed. Execution of the function block is complete when the Done output is set to 1.

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 outputs Done, Error, and ErrorID is maintained until a falling edge is detected at the Execute input.

    Do not reset the Execute input until the FB is finished by setting the Done state. Resetting the Execute input will result in resetting the outputs. In fast task cycle times, the asynchronous operation may not be completed and will result with a combination of unexpected output values.
    => Proceed with following file operations or reset the input only after the Done state has been reached.

  • 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

Handle

Outputs

Done

Error

ErrorID