-

Y_RW_Read_CSV_File

Image

This function block will read CSV (ASCII) data from a file on the controller's flash or ram disk. The raw file data will be parsed and copied into a user defined data structure. This function block requires customization to accommodate application specific data requirements. Any variety of rows and columns and datatypes can be specified.

Parameters:

* Parameter Data Type Description Default
VAR_IN_OUT
V Data Yt_RW_MyDataStruct A user customized data structure containing the definition of the rows and columns of data to be processed.
VAR_INPUT
B Execute BOOL Upon the rising edge, all other function block inputs are read and the function is initiated. To modify an input, change the value and re-trigger the execute input. FALSE
V
FileName STRING The file to be read. See path example in Memory area available for user files in ic92xx STRING#''
V Separators Yt_RW_SeparatorList Optional. If unconnected, the default separator is a comma (BYTE#44) to detect each value column by column. If a different or multiple characters must be treated as a value separator, populate the Yt_RW_SeparatorList with up to four byte values equating to the ASCII value of the separators. Comma (BYTE#44)
V HeaderRows UINT Optional. If connected, the value indicates the number of rows this function block must ignore before starting to look for actual data. UINT#0
V VerifyVersion BOOL Optional. If TRUE, this function block will expect the first line of the file to contain a version code for identifying the data format of the file, i.e columns, datatypes, etc. This allows for future changes to the Yt_RW_MyDataStruct while retaining the ability to parse older files created before a change was made to the structure of the file. FALSE
V BufferSize UDINT Specifies the number of bytes in the file to process at one time. If unconnected, the default is 2048 bytes. BufferSize can be adjusted up or down if necessary to accommodate various file sizes and will depend upon the CYCLIC task in which the Y_RW_Read_CSV_File function block is executed. UDINT#2048
VAR_OUTPUT
E Done BOOL Set high when the commanded action has completed successfully. If another block takes control before the action is completed, the Done output will not be set. This output is reset when Execute goes low.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, CommandAborted, or Error is true. In the case of a function block with an Enable input, a Busy output indicates the function is operating, but not ready to provide Valid information. (No Error)
B Error BOOL Set high if an error has occurred during the execution of the function block. This output is cleared when 'Execute' or 'Enable' goes low.
E ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute' or 'Enable' goes low.
V ErrorRow INT If Error is true and pertains to a problem with the source data, this value will indicate the location of processing when the error occurred.
V ErrorCol INT If Error is true and pertains to a problem with the source data, this value will indicate the location of processing when the error occurred.


Notes:

Error Description:

See the Function Block ErrorID List .

Examples:

Consider a file as shown below.

Image
Y_RW_Read_CSV_File must be customized to accommodate the application specific data.  To effectively use this function, follow these steps: Image
Image

Image
Image


Customization:

Versioning:

The function has the capability to read multiple versions of the same file.  For example, assume that initially, the design requires a data file to contain 4 columns of data to be used as INT.  Later, after some machines are in the field, a design change requires that the data file must now contain 5 columns of DINT.  If a version code is applied as the first row, the function block can determine how to read the file for any number of variations.  That may come later.  This will allow the use of older data files as well as newer formats.

Image
Image
To use file versioning, follow the steps below:
Image











 


This help information is valid for iCube Engineer Online Help 2025.6

Copyright © 2025 YASKAWA EUROPE GmbH and © 2025 YASKAWA America, Inc.