Open (FB; Prefix filop)¶
FUNCTION_BLOCK Open EXTENDS CBM.ETrig
This function block opens an already existing file or creates a new one. The return value is a file handle, which can then be used as an
input ”hFile
” in the function blocks ”FILE.Write”, ”FILE.Read”, ”FILE.Close”. There may be restrictions concerning the
specification of the directory name, e.g. only capital letters allowed, for different targets. The function ”FILE.GetProperty” shows
these restrictions.
- InOut:
Scope
Name
Type
Comment
Inherited from
Input
xExecute
BOOL
Rising edge: Action startsFalling edge: Resets outputsIf a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values (xDone
,xError
) are present at the outputs for exactly one cycle.ETrig
Output
xDone
BOOL
TRUE
: Action successfully completedETrig
xBusy
BOOL
TRUE
: Function block activeETrig
xError
BOOL
TRUE
: Error occurred, function block aborts actionFALSE
: No errorETrig
Input
sFileName
CAA.FILENAME
File name, absolute or relative path specification
eFileMode
File mode: FILE_MWRITE - write, FILE_MREAD - read, FILE_MRDWR - read & write, FILE_MAPPD - append
xExclusive
BOOL
- UNSUPPORTED PARAMETER: IS ALWAYS FALSE!
Note: Because of the POSIX behaviour of the file open functions on targets, there is no way to support xExclusive=TRUE! If a file still is opened, it can be deleted or renamed at the same time! Additionally a file can be opened several times (for reading and writing).
Output
eError
Local library error ID (0: no error; 5101: time out)
hFile
CAA.HANDLE
File handle