System_open block
Short summary
Name |
System_open |
→POU type |
|
Category |
more system blocks, blocks for calling system functions, block with internal error diagnostic |
Graphical interface |
|
Available since |
|
Functionality
The block prepares a file, device, or device file to be used by subsequent system calls, such as System_ioctl block, System_read block or System_write block.
Required expertise
In order to use this block efficiently, you have to be familiar with the functionality of the underlying system call for the operating system used on the PLC.
Inputs, outputs, return value
|
Identifier |
Description |
|
Inputs: |
pathname |
STRING |
string representing the resource |
flags |
DINT |
access mode and/or creation flags Possible values for Windows are listed under: http://www.delorie.com/djgpp/doc/incs/fcntl.h It is possible to combine values by using the IOR block (see example below). |
|
mode |
DINT |
file system permissions (optional; POSIX style) Possible values for Windows are listed under: https://www.rpi.edu/dept/cis/software/g77-mingw32/include/sys/stat.h |
|
Outputs: |
rc |
DINT |
return code:
|
errno |
DINT |
error code returned by the system call Windows standard values (valid for built-in PLC): see https://msdn.microsoft.com/en-us/library/t3ayayh1.aspx |
|
Return value: |
– |
DINT |
returns the file descriptor on success |
Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.
See:
"Blocks for safe logic" whether this block is supported for developing safety-relevant applications.
"Highlighting safe logic in the FBD-editor" for the effects when using the block as a block for safe logic .
Internal error diagnostic for block
The block checks the following error cases:
The system service has not been loaded.
The return value of the block is a negative value.
The return code of the function call equates to an error (output rc ≠ value 0).
In such an error case, the output ENO of the block is set to value FALSE (or an equivalent).
Example for usage within ST-editor
At present, there is no example.
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.