FC_GetTotalDiskSpace - General Information
Type: |
Function |
Available as of: |
SystemInterface_1.34.1.0 |
Support for: |
- |
Versions: |
Current version |
Read out the size of a memory medium.
This function reads out the size of a memory medium (flash disk, RAM disk, USB device) in bytes.
The name of the memory medium is transferred:
oFlash disk = "ide0:"
oRAM disk = "ram0:"
oUSB device = "usb2msd:0" (without partition table) or "usb2msd:1" (with partition table)
The size 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 memory size is to be read out |
Input/Output |
Data type |
Description |
---|---|---|
iq_uliTotalDiskSpace |
ULINT |
Size of the memory medium in byte |
Data type |
Description |
---|---|
DINT |
0: Size has been read out successfully -1: Error when reading the size -318: At least one of the parameters is invalid |
Requirement
The size of the flash disk in the controller shall to be determined in mega byte.
Declaration
PROGRAM RamDiskSize
VAR
uliTotalDiskSpace : ULINT := 0;
diStatus : DINT := 0;
diBytesOfMegaByte : DINT := 1048576; // = 1024 * 1024
diSizeOfRamdiskInMB : LINT := 0;
END_VAR
Program
diStatus := FC_GetTotalDiskSpace ( 'ide0:', uliTotalDiskSpace );
IF (diStatus = 0) THEN
diSizeOfRamdiskInMB := ULINT_TO_LINT(uliTotalDiskSpace) / diBytesOfMegaByte;
END_IF
Result
diSizeOfRamdiskInMB contains the size of the flash disk in mega byte.