Read from Static RM Filename in Advanced Ladder

See also: Removable Media in Advanced Ladder

See also: Project Toolbox for Advanced Ladder

Also called: Read Removable Media csv

 

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

File Name - This is the filename to read the values from and enter into the controller. This can be a constant or a set of 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 NULLClosed Null Termination - To place a NULL character (character code 0) at the end of ASCII data. Some functions require NULL Termination to be able to determine the end point of the ASCII data since that data may vary in length from one time to the next. (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.

File Offset - This parameters defines where in the file to start reading data. This can be a constant value or a 32-bit controller register. For example, a csv file contains the following data "123, 456, 789". The value "123" is element offset zero, the "456" is element offset one, and "789" is element offset two.

Destination Address - This is a controller register where the read data is placed. 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 read at a time this can fill a large number of registers from this starting point.

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

Number of Elements - This determines the number of elements to read it can be a constant or 16-bit controller register.

  • For ASCII types this becomes "Max Number of Characters" and sets the maximum number of characters that can be read from the file and stored in controller registers. Should a comma (not in quotation marks) be encountered before the Maximum Number of Characters has been read, then the function will stop reading characters instead of continuing to the Maximum Number of Characters specified.

  • For BOOL types this is always set to one.

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 read.

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 Read function before it is finished, the function will not be completed.

Return to the Top: Read from Static RM Filename in Advanced Ladder