Write to Static RM File in Advanced Ladder

See also: Removable Media in Advanced Ladder

See also: Project Toolbox for Advanced Ladder

 

Also called: Write RM csv

 

Note: This function allows writing a comma separated value file to the Removable Media interface from controller register space.

File Name - This is the filename to write the values from the controller. This can be a constant or a controller registers. If this is a constant it can be up to 147 characters long that includes sub directories (i.e. "my_data\test.csv"). If the filename is stored in registers it still has a limit of 147 characters and must be terminated with a NULL (byte containing zero). To indicate the file is in a register, place the percent (%) symbol before the register name. This is used to differentiate between "R1234" which is a valid file name and "%R1234" which is a register reference. File and directory names are limited to the 8.3 convention. This is 8 characters for the name and 3 characters for an extension with a period (.) separating them.

Mode - This is the writing mode for the function.

  • Create - Create a new file, error if file DOES exist.

  • Append - Add data to end of existing file, error if file does NOT exist.

  • Create / Append - Create the file if it does not exist, append if the file does exist.

  • Overwrite - if the file exists overwrite with a new file.

Columns per Row - This defines the format for writing data to the csv file. This can be a constant or 16-bit controller registers. When a csv file is written to a table format it can be viewed is a column / row format like a spreadsheet. Setting this parameter determines how many elements to write in a row before a new row is started. Setting this value to zero will disable the generation of new rows and will generate all data as a single row.

 

Examples

3 Columns per Row

1

2

3

4

5

6

7

8

9

5 Columns per Row

1

2

3

4

5

6

7

8

9

10

End of Row Now - Setting this option will cause the row to end at the end of this write function. See Columns per Row above.

Source Address - This is a controller register where the data to write is located. Because each element can require more than one 16-bit registers (DINTClosed Double Integer - [Data Type DINT] - A 32-bit signed value. Double Integers are used where the value of the data is expected to be in the range of -2,147,483,648 to +2,147,483,647., REALClosed REAL: Single precision floating point value - Real constant expressions must be valid number, and must include a dot ("."). If the user needs to enter a real expression having an integer value, add ".0" at the end of the number. The user can use "F" or "E" separators for specifying the exponent in case of a scientist representation. REAL is the default precision for floating points: such expressions do not need any prefix., LREALClosed The LReal is a 64-bit variable often referred to as double precision floating point or simply as a ‘double’. This feature allows Long Real data type to be configured in a program., UDINTClosed Unsigned Double Integer - [Data Type UDINT] - A 32-bit unsigned value. Unsigned Double Integers are used where the value of the data is expected to be in the range of 0 (zero) to 4,294,967,296., ASCIIClosed ASCII - American Standard Code for Information Interchange - ASCII-coded characters are single-byte values in the range of 0 (zero) to 127. Codes in the range 128 to 255 are not defined by the ASCII standard, but rather by the equipment manufacturer. types) and more than one element can be written at a time this can require a large number of registers from this starting point.

Type - This is the type of data that is written. There is no type or size information encoded in a csv file and it is the programmer’s responsibility to write data to a file using the correct type.

Number of Element - This determines the number of element to write it can be a constant or 16-bit controller register.

Status - This is a 32-bit controller registers used to show the status of the function block. The first 16-bit register is a status code, see the possible status codes in the status section below. The second 16-bit register shows the number of elements successfully written.

Rung Power - This function passes power once the Status returns a 0, assuming power is still applied to the function. Should power be lost to the Write function before it is finished, however, the function will still complete.

Return to the Top: Write to Static RM File in Advanced Ladder