This function ejects the media.
After this function is called, all files are closed, and the media is seen as not being present.
Input:
media : INT (0..3)
The media to eject.
Returns: INT
0
|
- Media is ejected.
|
-1
|
- Media cannot be ejected.
|
-16
|
- Media not present.
|
Declaration:
FUNCTION fsMediaEject : INT;
VAR_INPUT
media : INT;
END_VAR;
Example:
INCLUDE rtcu.inc
VAR
eject : BOOL;
END_VAR;
PROGRAM FileExample;
VAR
eject_old : BOOL;
rc : INT;
END_VAR;
...
IF eject THEN
IF NOT eject_old THEN
rc := fsMediaEject(media := 0);
IF rc = 0 THEN
DebugMsg(message := "Media ejected!");
ELSE
DebugMsg(message := "Media not present");
END_IF;
eject_old := TRUE;
END_IF;
ELSE
IF eject_old THEN
eject_old := FALSE;
END_IF;
END_IF;
...
END_PROGRAM;
|