FTP/FTPS communication with S7-1500 and CP 1543-1
An S7-1500 controller is to exchange data with a PC via FTP. The CP 1543-1 is ideally suited for this task as it can perform the function of both an FTP client and an FTP server.
The aim is to implement the following scenarios:
- The CP 1543-1 acting as an FTP client (active) requests data from an FTP server and stores it in a suitable data structure or sends a suitable data structure to an FTP server, where it is stored as a file.
- The CP 1543-1 acting as an FTP server provides its file system to an FTP client.
- You can implement both scenarios using FTP (unencrypted) or FTPS (encrypted).
The CP 1543-1 can be used both as an FTP server and as an FTP client. This apllication example describes the configuration as a server. Using the CP as a client requires that the "FTP_CMD" instruction be used. To facilitate the programming involved, we provide the "LFtp" library. The "LFtp_Communication" function block and the "LFtp_Param" data block enable you to integrate FTP communication into your project quickly and easily.
The CP supports FTP and FTPS. This allows you to transfer the data in an unencrypted or encrypted form.
The figure below shows the pictorial schematic and the hardware combination of this example application.
S7-1500 as FTP server:
The S7-1500 station is the FTP server via CP 1543-1 and can either receive data from an FTP client or send data to an FTP client upon request.
S7-1500 as FTP client:
The S7-1500 station is the FTP client via CP 1543-1 and can execute the following FTP commands:
- STORE (the client saves a file on the server)
- RETRIEVE (the client requests a file from the server)
- DELETE (the client deletes a file from the server)
- APPEND (the client attaches data to a file on the server)
- RETRIEVE_PART (the client requests parts of the data of a file from the server)
The solution presented here offers the following advantages:
- Simple and easy to understand FTP communication with an S7-1500 controller with the aid of the "LFtp" block library.
- Secure transfer via FTPS (FTP over TLS)
Documentation (2,3 MB)
Library for TIA Portal V15 (1,7 MB)
- FtpCommunication block changed to comply with styleguide.
- "LFtp" library created.
- FTPS added.
- Update to TIA Portal V15.