Ny-Series Instructions Reference Manual (W560 - Omron NY532-5400 Reference Manual

Ny-series
Hide thumbs Also See for NY532-5400:
Table of Contents

Advertisement

2 Instruction Descriptions
 Enumeration Data
STRING data that expresses a DINT variable is converted to an enumerator of the enumeration. The
same rules as for integers are used to convert to DINT data, the value of the DINT data is taken as
the value of the enumeration, and that value is converted to the corresponding enumerator. How-
ever, conversion is not possible if the STRING data does not express a DINT value. For example,
assume that an enumeration Color has three enumerators: red, yellow, and green. The numbers
associated with these enumerators are as follows: red = 1, yellow = 2, green = 3. If the data is '3', the
value of the member will be green.
 Array Data
Each delimited data is converted to the value of an element. The conversion rules for the data type
of the array are used. Conversion is possible only if the members are one-dimensional arrays. For
example, assume that a member is the myString[0..3] BYTE array. If the comma-delimited text string
'AA,BB,CC,DD' is converted to the elements of the array, myString[0] will be BYTE#16#AA,
myString[1] will be BYTE#16#BB, myString[2] will be BYTE#16#CC, and myString[3] will be
BYTE#16#DD.
Notation Example
The following notation reads comma-delimited data from the myString text string and stores the text
strings as the values of the members of the myStruct structure.
LD
SubDelimiter
EN
myString
In
OutStruct
myStruct
_COMMA
Delimiter
myString
'XYZ,1234,aB,3.14'
Member
Structure
myStruct
member1
member2
member3
member4
Additional Information
• You can combine this instruction with the FileGets instruction (page 2-1281) to easily read values
from specified CSV files in an SD Memory Card. Refer to Sample Programming for an application
example.
• Use this instruction to return a text string that was converted with the AddDelimiter instruction (page
2-571) to structure data.
Precautions for Correct Use
• If there is more than one consecutive delimiter in In, the delimited data will not exist. If the delimited
data does not exist, the value of the member of OutStruct will be undefined.
• Do not use the delimiter in In for anything other than the delimiter. If you use the delimiter for any
other purpose, the instruction will still treat it as a delimiter.
2-586
ST
SubDelimiter(myString,myStruct,_COMMA);
ENO
Data type
Value
STRING
' '
INT#0
INT
WORD
WORD#16#0000
REAL
REAL#0
Data from myString is stored as the values of the members of myStruct.
Member
Data type
Structure
myStruct
member1
STRING
member2
INT
member3
WORD
member4
REAL

NY-series Instructions Reference Manual (W560)

Value
'XYZ'
INT#1234
WORD#16#00AB
REAL#3.14e+0

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents