fsMediaPresent (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


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
  // Update media status
  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;
        // Open files
        ...
    ELSE
        DebugMsg(message := "Media has been removed!");
    END_IF;
    // Save current status
     mediaPresent := fsMediaPresent(media := 0);
  END_IF;
  ...
END;
 
END_PROGRAM;