ControlLogix and CompactLogix Datalogging to CSV File

The Automation School – PAC Basics – Article Banner Top
Log to CSV file on CompactFlash or SecureDigitalA couple of years ago, prior to the release of Studio 5000 v21, Rockwell demonstrated a future feature for it's new “multi-core” programmable automation controllers. This new feature was a very robust, controller based data logging system.

Unfortunately, since that demo a couple of years back nothing more has been hear about this feature. Well, at least I haven't been able to find anything out despite my efforts. However, I can confirm it's not in the soon to be released version 22, which was the originally targeted release.

But even without that new feature there is a way to log CSV files to you CompactLogix or ControlLogix's Compact Flash or SD card. And it's accomplished with a piece of free sample code from Rockwell's own sample code website. Below is a link to the free code in question:

Log to CSV file Samle Code Download

Log to CSV file on CompactFlash or SecureDigital

Log to CSV Slot NumberHaving tested the sample myself, I have to say it works as advertised. Simply changed the code to match your processor model and version (the sample code is version 17,) change one rung to indicate the slot of your processor, and download.

Log to CSV enableThere are two Tags in the program which controls it's behavior. The first Tag is the “logging_enabled” bit, which does just what it says. The second Tag is “max_file_size,” and this is the setpoint that when reached will unlatch the “logging_enabled” bit.

Log to CSV sizeThe output of this program is a CSV file which is easily opened in Microsoft Excel. Once open, you set the first column to the Date format, and the second column to Time format, and you end up with a document which looks just like the example below:

Log to CSV file on CompactFlash or SecureDigital

Unlike the “CF_Read_Write_Example” I mentioned earlier this year, this code is not so much an application example as it is a proof of concept.

In my opinion, to make this code fully functional the following features would need to be added:

  • Easy way to tell which tags are being logged, and add new tags to be logged.
  • Addition of a series of tags to be used as “row 1 headers”
  • Automatically create new files at a predetermined time (midnight)
  • Easy way to specify CSV file naming parameters
  • Automatic deletion of older files after a certain number of files are present, or a percentage of the card had been filled.

That said, if you need to log to your CompactLogix or ControlLogix external CF or SD card, this sample code is a simple and easy to use free solution.

Log to CSV file Samle Code Download

I hope you've found this article about logging to a CompactLogix or ControlLogix external CF or SD card helpful. If you have any questions, comments, or corrections, please don't hesitate to share them with us by using the “leave a reply” form at the bottom of this page.

Sincerely,

Shawn Tierney
Automation Blogger and Trainer

Need personalized help? For as little as $25 per month you can get direct access to ask me Rockwell PLC, HMI, and SCADA questions! Learn the details at Patreon.com/Automation

The Automation School – PAC Basics – Article Banner Top

Check Also

ControlLogix Training Video and Detailed Lessons

What should you learn if you're going to start programming or maintaining Allen-Bradley ControlLogix Programmable …

What’s New in Studio 5000 Logix Designer v30

Version 30 of Studio 5000 Logix Designer programming software has been release for Rockwell's 5370 and …