FP_SD_MOVE_FILE

Move file on SD card

This FP instruction moves the file specified by s1_FullFileNameSource to the file specified by s2_FullFileNameDestination.

Parameters

Input

s1_FullFileNameSource (STRING)

Source file and directory

s2_FullFileNameDestination (STRING)

Destination file and directory

s3_Format (WORD)

File transfer format:

Bit 0:

  • 0: Overwrite if file exists

  • 1: Abnormal end if file exists

Bit 1–15: Reserved for the system

Remarks

  • 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.
  • If the directory specified by s2_FullFileNameDestination does not exist, error 3 "File/directory name error" occurs.

  • If there is not enough free capacity, error 9 "SD card full" occurs.

  • If a directory is specified for s1_FullFileNameSource and a file for s2_FullFileNameDestination, error 3 "File/directory name error" occurs.
  • If a directory is specified by s1_FullFileNameSource, all files in this directory are moved to the directory specified by s2_FullFileNameDestination.

  • Subdirectories are not moved.

  • Write-protected files which are moved will keep their status.

  • The free capacity on the SD card must be larger than the files to be moved.

  • If a file is specified by s1_FullFileNameSource and a directory by s2_FullFileNameDestination, the file is moved to the directory.

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if the area specified using the index modifier exceeds the limit.
sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if the area specified using the index modifier exceeds the limit.

Example

POU header

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

POU body

When the variable bStart changes from FALSE to TRUE and the system variable sys_bIsSDMemoryAccessActive is not TRUE, the function is carried out. It moves the file 'TestString1.csv' from the root directory of the SD card to the directory 'Test'.

LD body

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_VARIN,,'\TestString1.csv',21,2,23,4,);
B(B_VARIN,,'\Test\TestString1.csv',21,3,23,5,);
B(B_VARIN,,0,21,4,23,6,);
B(B_CONTACT,,bStart,3,1,5,3,R);
B(B_CONTACT,,sys_bIsSDMemoryAccessActive,11,1,13,3,N);
B(B_F,FP_SD_MOVE_FILE!,,23,0,37,6,,?DEN?Ds1_FullFileNameSource?Ds2_FullFileNameDestination?Ds3_Format?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

ST body

IF DF(bStart)AND not sys_bIsSDMemoryAccessActive then
    FP_SD_MOVE_FILE('\TestString1.csv', '\Test\TestString1.csv');
END_IF;

Modified on: 2024-03-06Feedback on this pagePanasonic hotline