
{REDUND_ERROR} FUNCTION_BLOCK ReadFileOnDisk (*TODO: Add your comment here*) (*$GROUP=User,$CAT=User,$GROUPICON=User.png,$CATICON=User.png*)
	VAR_INPUT
		Execute : {REDUND_UNREPLICABLE} BOOL;
		file_device : STRING[80];
		file_path : STRING[80];
		data_adr : DINT;
	END_VAR
	VAR_OUTPUT
		Done : {REDUND_UNREPLICABLE} BOOL;
		file_size : {REDUND_UNREPLICABLE} DINT;
	END_VAR
	VAR
		file_open : FileOpen;
		file_read : FileRead;
		file_close : FileClose;
		step : DINT;
	END_VAR
END_FUNCTION_BLOCK

{REDUND_ERROR} FUNCTION_BLOCK WriteFileOnDisk (*TODO: Add your comment here*) (*$GROUP=User,$CAT=User,$GROUPICON=User.png,$CATICON=User.png*)
	VAR_INPUT
		Execute : {REDUND_UNREPLICABLE} BOOL;
		file_device : {REDUND_UNREPLICABLE} STRING[80];
		file_path : {REDUND_UNREPLICABLE} STRING[80];
		data_adr : DINT;
		file_size : {REDUND_UNREPLICABLE} DINT;
	END_VAR
	VAR_OUTPUT
		Done : {REDUND_UNREPLICABLE} BOOL;
	END_VAR
	VAR
		file_open : {REDUND_UNREPLICABLE} FileOpen;
		file_create : {REDUND_UNREPLICABLE} FileCreate;
		file_write : {REDUND_UNREPLICABLE} FileWrite;
		file_close : {REDUND_UNREPLICABLE} FileClose;
		step : {REDUND_UNREPLICABLE} DINT;
		ident : {REDUND_UNREPLICABLE} UDINT;
	END_VAR
END_FUNCTION_BLOCK

{REDUND_ERROR} {REDUND_UNREPLICABLE} FUNCTION_BLOCK FileExample01_Gcode (*3x3 flyways 1 xbot - DeleteGCode,SaveGCode,ReadGCode,GetGCodeIDs,RunGCode. G-code file 'GCodeDemo.txt' must be in the root directory of the FileDevice*) (*$GROUP=User,$CAT=User,$GROUPICON=User.png,$CATICON=User.png*)
	VAR_INPUT
		Execute : {REDUND_UNREPLICABLE} BOOL;
		FileDevice : {REDUND_UNREPLICABLE} STRING[80]; (* the file device that has the file on it *)
	END_VAR
	VAR_OUTPUT
		Done : {REDUND_UNREPLICABLE} BOOL;
	END_VAR
	VAR_IN_OUT
		PM_Controller : PMControllerType; (* the planar motor controller to use*)
	END_VAR
	VAR
		Read_file : {REDUND_UNREPLICABLE} ReadFileOnDisk;
		sent_Gcode_data : {REDUND_UNREPLICABLE} ARRAY[0..199999] OF SINT;
		sent_data_size : {REDUND_UNREPLICABLE} DINT;
		PMC_DeleteGCode1 : {REDUND_UNREPLICABLE} PMC_GCode_DeleteGCode;
		PMC_SaveGCode1 : {REDUND_UNREPLICABLE} PMC_GCode_SaveGCode;
		PMC_ReadGCode1 : {REDUND_UNREPLICABLE} PMC_GCode_ReadGCode;
		read_Gcode_data : {REDUND_UNREPLICABLE} ARRAY[0..199999] OF SINT;
		read_data_size : {REDUND_UNREPLICABLE} DINT;
		PMC_GetGCodeIDs : {REDUND_UNREPLICABLE} PMC_GCode_GetGCodeIDs;
		PMC_RunGCode1 : {REDUND_UNREPLICABLE} PMC_GCode_RunGCode;
	END_VAR
END_FUNCTION_BLOCK

{REDUND_ERROR} {REDUND_UNREPLICABLE} FUNCTION_BLOCK FileExample02_ReadLogs (*any combination of flyways and xbots - GetErrorLog, GetWarningLog. Any existing 'warning_log.txt' or 'error_log.txt' file in the root directory of the FileDevice will be overwritten*) (*$GROUP=User,$CAT=User,$GROUPICON=User.png,$CATICON=User.png*)
	VAR_INPUT
		Execute : {REDUND_UNREPLICABLE} BOOL;
		FileDevice : {REDUND_UNREPLICABLE} STRING[80]; (* the file device that has the file on it *)
	END_VAR
	VAR_OUTPUT
		Done : {REDUND_UNREPLICABLE} BOOL;
	END_VAR
	VAR_IN_OUT
		PM_Controller : PMControllerType; (* the planar motor controller to use*)
	END_VAR
	VAR
		PMC_GetWarningLog1 : {REDUND_UNREPLICABLE} PMC_GetWarningLog;
		warninglog : {REDUND_UNREPLICABLE} ARRAY[0..99999] OF SINT;
		write_warning_log : {REDUND_UNREPLICABLE} WriteFileOnDisk;
		PMC_GetErrorLog1 : {REDUND_UNREPLICABLE} PMC_GetErrorLog;
		errorlog : {REDUND_UNREPLICABLE} ARRAY[0..99999] OF SINT;
		write_error_log : {REDUND_UNREPLICABLE} WriteFileOnDisk;
	END_VAR
END_FUNCTION_BLOCK

{REDUND_ERROR} {REDUND_UNREPLICABLE} FUNCTION_BLOCK FileExample03_Trajectory (*1x1 1 xbot - DeleteTrajectory, SaveTrajectory, ReadTrajectoryHash. Trajectory file 'TrajectoryDemo.txt' must be in the root directory of the FileDevice*) (*$GROUP=User,$CAT=User,$GROUPICON=User.png,$CATICON=User.png*)
	VAR_INPUT
		Execute : {REDUND_UNREPLICABLE} BOOL;
		FileDevice : {REDUND_UNREPLICABLE} STRING[80]; (* the file device that has the file on it *)
	END_VAR
	VAR_OUTPUT
		Done : {REDUND_UNREPLICABLE} BOOL;
	END_VAR
	VAR_IN_OUT
		PM_Controller : PMControllerType; (* the planar motor controller to use*)
	END_VAR
	VAR
		Read_file : {REDUND_UNREPLICABLE} ReadFileOnDisk;
		TrajData : {REDUND_UNREPLICABLE} ARRAY[0..499999] OF SINT;
		PMC_XYMotion1 : {REDUND_UNREPLICABLE} PMC_XYMotion;
		PMC_DeleteTrajectory1 : {REDUND_UNREPLICABLE} PMC_DeleteTrajectory;
		PMC_Deactivatexbots1 : {REDUND_UNREPLICABLE} PMC_DeactivateXbots;
		PMC_SaveTrajectory1 : {REDUND_UNREPLICABLE} PMC_SaveTrajectory;
		PMC_Activatexbots1 : {REDUND_UNREPLICABLE} PMC_ActivateXbots;
		PMC_ReadTrajectoryHash1 : {REDUND_UNREPLICABLE} PMC_ReadTrajectoryHash;
		xbotID_array12 : {REDUND_UNREPLICABLE} ARRAY[0..11] OF USINT;
		trajID_array12 : {REDUND_UNREPLICABLE} ARRAY[0..11] OF USINT;
		PMC_ActivateTrajectory1 : {REDUND_UNREPLICABLE} PMC_ActivateTrajectory;
	END_VAR
END_FUNCTION_BLOCK

{REDUND_ERROR} FUNCTION_BLOCK FileExample04_Configuration (* any configuration of xbots and flyways - SetConfiguration, GetConfiguration. Configuration XML file 'PMCConfig.xml' must be in the root directory of the FileDevice *) (*$GROUP=User,$CAT=User,$GROUPICON=User.png,$CATICON=User.png*)
	VAR_INPUT
		Execute : {REDUND_UNREPLICABLE} BOOL;
		FileDevice : {REDUND_UNREPLICABLE} STRING[80]; (* the file device that has the file on it *)
	END_VAR
	VAR_OUTPUT
		Done : {REDUND_UNREPLICABLE} BOOL;
	END_VAR
	VAR_IN_OUT
		PM_Controller : PMControllerType; (* the planar motor controller to use*)
	END_VAR
	VAR
		ReadFile : {REDUND_UNREPLICABLE} ReadFileOnDisk;
		send_config_array500000 : {REDUND_UNREPLICABLE} ARRAY[0..499999] OF SINT;
		read_config_array500000 : {REDUND_UNREPLICABLE} ARRAY[0..499999] OF SINT;
		PMC_SetConfiguration1 : {REDUND_UNREPLICABLE} PMC_Config_SetConfiguration;
		PMC_Reboot1 : {REDUND_UNREPLICABLE} PMC_Reboot;
		PMC_GetConfiguration1 : {REDUND_UNREPLICABLE} PMC_Config_GetConfiguration;
		PMC_DeactivateXbots1 : PMC_DeactivateXbots;
	END_VAR
END_FUNCTION_BLOCK
