CSV_File library support for AS6

I am looking for a version of the unofficial library CSV_File which is supported in Automation Studio 6, does anyone know if this version exists or there are any plans to develop it?

What is this library doing? Does it just write data in a CSV format or do you also read it back?

To be honest I do not understand the “problem”

This library is a not official library placed on the “Library base” on the B&R homepage:

File Handling (CSV_Lib) | B&R Industrial Automation

It offers the source code as well. Therefor you could modify it and/or simply rebuild it for AS6:

OK great thanks, yes I can modify the library source code to work, but wanted to check if there was going to be sure there was no new version going to be added to the Library base to support this already.

Just a warning from prior experience, for those coming upon this later, it doesn’t make what most people would expect as a CSV file, i.e. 1st line is column names, rest of the lines are comma separated values. Instead it’s more of a hierarchy tree of variable name, type value, with elements of arrays and structures offset with tabs. It loads nicely into a excel because it does do tabs/commas to create the hierarchal tree.

It creates the text file in memory with all the non-value data , but leaving byes of blank for the value, when you call the Init function block. This function block is best called in INIT or in a task class #8 (lowest priority, huge tolerence). When you call the WriteFile function, it then takes the current data of the PV’s you have initialized and fills in their values in the text file in the blank spots in memory. Then it writes to the file (i.e. dumps the file in memory to file on disk). When I used it last, it also hard failed when the text file structure didn’t match exactly the version in memory on the PLC (i.e. if you had added members to a structure in a project and then tried to load an older saved file.) This may have gotten fixed with some sort of file version support, but it wasn’t there when I last used it.

1 Like