This queries if the media is inserted (present) in the RTCU device.
Input:
media : INT (0..3)
The media to query.
Returns: BOOL
TRUE:
|
Media is present.
|
FALSE:
|
Media is not present.
|
Declaration:
FUNCTION fsMediaPresent : BOOL;
VAR_INPUT
media : INT;
END_VAR;
Example:
INCLUDE rtcu.inc
PROGRAM FileExample;
VAR
mediaPresent : BOOL;
rc : INT;
END_VAR;
fsMediaOpen(media := 0);
BEGIN
IF mediaPresent <> fsMediaPresent(media := 0) THEN
IF fsMediaPresent(media := 0) THEN
IF fsMediaWriteProtected(media := 0) THEN
DebugMsg(message := "Media present, media write protected!");
END_IF;
...
ELSE
DebugMsg(message := "Media has been removed!");
END_IF;
mediaPresent := fsMediaPresent(media := 0);
END_IF;
...
END;
END_PROGRAM;
|