Type: |
Function |
Available as of: |
SystemInterface_1.34.1.0 |
Support for: |
- |
Versions: |
Current version |
This function reads out the free memory space of a memory medium (flash disk, RAM disk, USB device) in bytes. The name of the memory medium is transferred:
Flash disk = "ide0:"
RAM disk = "ram0:"
USB device = "/usb2msd16a"
The free memory space of a remote device cannot be read out. If a remote device is specified as parameter, then the function returns "-1".
Input |
Data type |
Description |
---|---|---|
i_sVolumeName |
STRING[80] |
Name of the device whose free memory space shall be read out |
Input/Output |
Data type |
Description |
---|---|---|
iq_uliFreeDiskSpace |
ULINT |
Free memory space in byte |
Data type |
Description |
---|---|
DINT |
0: Free memory space was read out successfully -1: Error when reading out the free memory, for example, an invalid device or remote device was selected -318: Invalid parameter (i_sVolumeName) |
Requirement
The free memory space on a USB device has to be determined. For this, the USB device has to be detected successfully.
Declaration
PROGRAM FreeUSBDiskSpace
VAR
uliFreeDiskSpace : ULINT := 0;
diStatus : DINT := 0;
diBytesOfMegaByte : DINT := 1048576; // = 1024 * 1024
diFreeDiskSpaceInMB : LINT := 0;
END_VAR
Program
diStatus := FC_GetFreeDiskSpace ( '/usb2msd16a', uliFreeDiskSpace );
IF (diStatus = 0) THEN
diFreeDiskSpaceInMB := ULINT_TO_LINT(uliFreeDiskSpace) / diBytesOfMegaByte;
END_IF
Result
diFreeDiskSpaceInMB contains the free memory space of the USB memory medium in Mb.