The Horner APG XL4 all in one controller through the Ethernet port can set up a FTP server. This FTP (File Transfer Protocol) server can be used to move files from the controller to the network. The server can have different security for reading and writing the files. We will use the program on the process tank to move the recipe file and report files to another location on the network. The command line prompt, automated batch file, windows explorer and a free windows FTP client software will be used.
Previously we discussed the following in our Horner XL4 Series:
Installing the Software Cscape
Cscape Software Setup
Numbering System and Addressing
Timers and Counters
Compare and Move Instructions
Program Control Instructions
Rotate and Shift Register
Modbus RTU Instructions
What is FTP? – Horner FTP Server
The FTP (File Transfer Protocol) is a standard network protocol used to transfer computer files between a client and server on a computer network. Command-line programs were first used for FTP and still ship with most operating systems. Many FTP clients and automation utilities have since been developed for desktops, servers, and mobile devices.
The previous examples of a process mixer with different recipes and reports stored the information on a micro SD card. (See Recipe Instruction and Report Generator from the list above.) Using the FTP server we can now retrieve this information from the Horner APG XL4 without unplugging the memory card from the controller.
Setting up the FTP Server on the Horner APG XL4
Select Controller | Hardware Configuration… from the main menu. You can also select Hardware Configuration under the Project Navigator Tab.
This will call up our hardware configuration window for the controller.
Select Config next to LAN1 (ETN300)
Under this configuration window, we will now select the FTP (File Server) under resident protocols.
Hitting the button Configure Selected Protocols will allow us to configure the FTP Server.
The FTP Configuration window now appears. We will set User 1 and 2 as follows:
User 1 – Name: ReadOnly Password: read-only – radio button Read Only
User 2 – Name: FullAccess Password: fullaccess – radio button Read / Write
Select OK to confirm these entries.
We have now set up the controller for an FTP server.
Using an FTP Client we can retrieve the files that are located on the server. In our case, we have two files. (MREPORT.CSV and Mixer.csv)
We will use several different methods to retrieve the files on our FTP server.
Transfer files using windows DOS commands – Horner FTP Server
1 – Open a command prompt. Start type cmd.
2 – At the C:\> prompt type FTP. The C:\> prompt changes to ftp>
3 – At the ftp> prompt type open followed by the mane of the remote FTP site, then press ENTER. Example: open 192.168.1.131
4 – When prompted, type the username and password we set up above for the Read-Only option.
5- Type binary and press ENTER. This will change the transfer mode.
6 – Type dir to display a list of files on the server
7 – Type get filename and then press ENTER to transfer the file.
8 – Type bye to close the connection.
Transfer files automatically using a BATCH (BAT) file – Horner FTP Server
We can automate the retrieval of files by the use of a BAT file. This file will automate the DOS commands mentioned above. The following is a batch file called ftpbat.bat.
::Enter user name and password
echo user ReadOnly> ftpcmd.dat
echo readonly>> ftpcmd.dat
echo bin>> ftpcmd.dat
::If a specific file is asked for then retrieve it
IF “%1″==”” GOTO deffile
echo get %1>> ftpcmd.dat
::Default file to ask for if nothing specified
echo get mreport.csv>> ftpcmd.dat
::Get the file using FTP
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat 192.168.1.131
You can see that this is an older scripting language, but still usable today for redundant tasks like backing up the files.
Here is the result when running the above batch script both without specifying the file and with specifying the file.
Transfer Files using Windows Explorer – Horner FTP Server
Call up windows explorer by hitting the windows orb and selecting the computer. On the address line, type ftp://192.168.1.131. This will call up a dialog window to enter your user name and password. Enter the settings set above and you can then use a windows explorer window to transfer files.
Transfer files using a windows FTP Client program – Horner FTP Server
FTP Surfer is a free FTP client program for windows written by Whisper Technologies Ltd. It is available at the following URL address:
This internet explorer-style user interface includes an address bar, history, and favorites menu.
We create a profile from the main menu. Select File | New | Site Profile.
Enter the values that we set above for Full Access – Read / Write then hit OK.
Now we can look at the information on the SD memory card as easily as our own computer hard drive.
See this logic in action by watching the YouTube video below.
You can download this application here. It will contain all of the screens and logic programming.
All of the documentation for the XL4 can be downloaded at the following URL:
Next time we will look at HTTP (Hypertext Transfer Protocol) Web Server.
Watch on YouTube: Horner XL4 FTP File Transfer Protocol Server
If you have any questions or need further information please contact me.
If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.
To get this free article, subscribe to my free email newsletter.
Use the information to inform other people how numbering systems work. Sign up now.
The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.