Data logging is the ability to save and view data from the PLC in a format that we can utilize elsewhere on the network. The Horner APG XL4 has this feature in its design to periodically log registers to removable media. (Micro SD) This data is stored in .CSV (comma-separated value) format which is compatible with many computer applications such as Microsoft Excel.
Horner provides one of the easiest methods that I have seen to get data logging. You can log 30 registers in a log group and have 10 separate groups. Each group has its own configurable timer that determines the automatic reading and logging of the variables (registers). The group also has a manual trigger bit that can be set to log the variables.
This all-in-one controller provides the easiest way to log data. We will look at how to configure and utilize this feature of the PLC.
Previously we discussed the following in our Horner APG 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
FTP File Transfer Protocol Server
Horner XL4 HTTP Web Server
Modbus TCP AdvancedHMI Communication
Datalog Configuration – Horner XL4 Data Logging
Using our existing process tank application we will now setup data logging to our micro SD card.
On the main menu of Cscape select Program | Datalog Configuration…
This will call up the Data Log Configuration window.
Select the Enable Data Log. This will enable all other options.
Select the Global Attributes. This will allow us to set the attributes that apply to all of the data logging required.
Global Status Register – This is an optional register that will contain two 16 bit registers. The first will show the status of the media. (Micro SD)
Status 0 – Media ready for Data Logging
Status 1 – Media not formatted
Status 2 – Media not present
Status 4 – Media inserted but not yet ready
Status 5 – Media critical error
Status 6 – Media protected (%SR174)
The second register will show the percentage full of the media card. Our example will use %R3000.
Global Enable Register – This must be set in order for data logging to occur. In our example, we will set this to %S007. (Always on bit)
Click OK to return to the Data Log Configuration. You will notice that the Global Attribute Details will display on the screen.
Select Add Group
This group name can be 8 characters in length. Once a name has been entered select OK.
Our name entered was PTank representing our process tank. Highlighting the name PTank will now display the variables that we can set in this group.
Under the Group Attribute Details, select Group Attributes.
Group Status Register – This is optional and is the same as the Global Status Register.
Manual Trigger Register – This is optional to record the log information. In our case, we will be using the Sequence Tank Empty to detect the end of the cycle so we can record the product cycle complete.
Data Log Setup – This has several parameters to determine how and where to record.
Data Log Interval – This selection can be set for Minutes, Seconds or Trigger Only. We will set this for trigger only because we want to record when the cycle is complete.
Data Log Path – We can specify where on the micro SD card that the information will be logged. The default is in the root directory.
Date Log – Date Format – This is the format of the date that is recorded every time that the information is logged.
Date Log – Time Format – This is the format of the time that is recorded every time that the information is logged.
Select Add Variable. We will not tell the controller what parameters that we would like to log each time the trigger activates.
In our example we will log the following:
%R00100 – Mix Time
%R00102 – A Ingredient
%R00104 – B Ingredient
%R00106 – C Ingredient
Adding each of the variables and returning to the Data Log Configuration Screen our group is now complete for PTank.
FTP (File Transfer Protocol) – Horner XL4 Data Logging
Our data logging is now complete. We can now run the program and see our results.
Using FTP we can log into the directory.
Select the PTANK folder.
Select the 170115.CSV file. In my case, this extension defaults to the Microsoft Excel program. Alternatively, you can call up your program that will read a CSV file and view the contents.
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:
This ends our series on the Horner APG XL4 all in one controller. We have covered a great deal of the features of this controller; however, these features are constantly changing with each new release. Please refer to the Horner website for tech notes and other offerings. Thank you for viewing this series.
Watch on YouTube: Horner XL4 Data Logging
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 PLCs 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.
2 thoughts on “Horner XL4 Data Logging – All In One Controller”
Thank you for sharing this knowledge on the YouTube tutorial. I got a question about how the manual trigger works. Does it log upon the rising edge of the trigger bit? or keep logging while the trigger bit is ON?
Good question. The logging will happen upon the rising edge (transition) of the trigger bit. If continuous logging is required then set up the Data Log Interval for Minutes or Seconds. (No Trigger)
I hope this helps you out.