Rename file on SD card
This FP instruction renames the file specified by s1_FullFileNameOld to the new file name specified by s2_FullFileNameNew.
Input
Old file name
New file name
Please also refer to precautions for SD card access.
The SD memory access active flag (sys_bIsSDMemoryAccessActive) turns to TRUE after the trigger EN of the SD card instruction has turned to TRUE and remains TRUE until execution has completed. During this time, other SD card instructions cannot be executed.
The SD memory access done flag (sys_blsSDMemoryAccessDone) is FALSE when the instruction is executed and turns to TRUE and remains TRUE when the instruction is completed.
FALSE: when the instruction has completed without error
TRUE: when the instruction has completed with an error
Use sys_iSDMemoryAccessErrorCode to evaluate the error code.
if the area specified using the index modifier exceeds the limit.
if the area specified using the index modifier exceeds the limit.
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
bStart: BOOL:=FALSE;
(*activates the instruction*)
END_VAR
When the variable bStart changes from FALSE to TRUE and the system variable sys_bIsSDMemoryAccessActive is not TRUE, the function is carried out. It renames the file 'TestString2.csv' in the directory 'Test' into 'TestString3.csv'.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 6 ;
NETWORK_BODY
B(B_CONTACT,,bStart,3,1,5,3,R);
B(B_VARIN,,'\Test\TestString2.csv',21,2,23,4,);
B(B_VARIN,,'\Test\TestString3.csv',21,3,23,5,);
B(B_CONTACT,,sys_bIsSDMemoryAccessActive,11,1,13,3,N);
B(B_F,FP_SD_RENAME_FILE!,,23,0,35,5,,?DEN?Ds1_FullFileNameOld?Ds2_FullFileNameNew?AENO);
L(1,2,3,2);
L(5,2,11,2);
L(13,2,23,2);
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DF(bStart)AND not sys_bIsSDMemoryAccessActive then
FP_SD_RENAME_FILE('\Test\TestString2.csv', '\Test\TestString3.csv');
END_IF;