fsMediaClose (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


This closes the media. Use this function to disable communication to the media. After the media is closed, the file system cannot be used until the media is opened again.

 

Please also see fsMediaOpen (Function).

 

 

Input:                

media : INT (0..3)

The media to close.

 

Returns:

None

 

Declaration:

FUNCTION fsMediaClose;
VAR_INPUT
  media : INT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  filesys : BOOL;
END_VAR;
 
PROGRAM test;
VAR
  fs_open : BOOL;
END_VAR;
 
BEGIN
  ...
  IF filesys THEN
    IF NOT fs_open THEN
        IF fsMediaOpen(media := 0) <> 0 THEN
          DebugMsg(message := "fsMediaOpen - Failed!");
        ELSE
          fsStatusLEDEnable(enable := ON);
           fs_open := TRUE;
        END_IF;
    END_IF;
  ELSE
    IF fs_open THEN
        fsMediaClose(media := 0);
        fsStatusLEDEnable(enable := OFF);
        fs_open := FALSE;
    END_IF;
  END_IF;
  ...
END;
END_PROGRAM;