Hello,
I am new to CXA_FileAsync with FB IL_FileWriteAsync for datalogging, are there any function block or possible to automatically transfer the data logged csv files from ctrlX to my PC every hour?
Warmest regards,
Solved! Go to Solution.
Moves to own topic from this one.
There are several ways to do so. First I like to mention that the CXA_SocketComm library also includes FTP and TFTP protocol to send files to a server e.g. your PC.
Hello CodeShepherd,
Thank you for your reply!
I am new to CXA_SocketComm and FTP are there any examples to use the FTP IL_FTPGetAsync function block?
We need to transfer data csv file from ctrlX to the PC.
Warmest regards,
Hi,
Here is asimple demo code, maybe helpfull for you.
Declaration:
PROGRAM IL_FTPPut_Test
VAR
fbFTPPut : IL_FTPPutAsync;
fbFTPPutFile : IL_FTPPutFileAsync;
filebuf: STRING(5000) := 'asdasd$R$N12312312$R$Npoipoi$R$N';
sendlen: UDINT;
itestcase: INT;
END_VAR
Implementation:
fbFTPPut();
fbFTPPutFile();
CASE itestcase OF
1: // put string
fbFTPPut.Address := '192.168.1.101';
fbFTPPut.Login := 'MyPcUserName';
fbFTPPut.Password := '';
fbFTPPut.RemoteFile := 'ftpsavefile'; // existing file
fbFTPPut.ValueAdr := ADR(filebuf);
fbFTPPut.NoOfBytes := IL_LEN(adr(filebuf));
sendlen := fbFTPPut.NoOfSendBytes;
fbFTPPut.Execute := TRUE;
IF fbFTPPut.Done THEN
fbFTPPut.Execute := FALSE;
itestcase := 0;
END_IF
2: // put fie
fbFTPPutFile.Address := '192.168.1.101';
fbFTPPutFile.Login := 'MyPcUserName';
fbFTPPutFile.Password := '';
fbFTPPutFile.RemoteFile := 'ftpcoty.scope'; //300kB
fbFTPPutFile.LocalFile := ADR('_cnc/xy_2.scope');
sendlen := fbFTPPutFile.NoOfSendBytes;
fbFTPPutFile.Execute := TRUE;
IF fbFTPPutFile.Done THEN
fbFTPPutFile.Execute := FALSE;
itestcase := 0;
END_IF
END_CASE