2-453
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Conversion Instructions
2
ToA r y B yt e
ToAryByte
The ToAryByte instruction separates a variable into bytes and stores the bytes in a BYTE array.
* If you omit the input parameter, the default value is not applied. A building error will occur.
The ToAryByte instruction separates the value of data to convert In into individual bytes and stores
them in order in conversion results array AryOut[] starting from AryOut[0]. Number of elements in result
Out contains the number of elements stored in AryOut[].
Conversion order Order specifies the order in which to convert the value of In to bytes. The data type of
Order is enumerated type _eBYTE_ORDER. The meaning of the enumerators are as follows:
Instruction Name FB/FUN Graphic expression ST expression
ToAryByte Conversion to Byte
Array
FUN Out:=ToAryByte(In, Order,
AryOut);
Variables
Name Meaning I/O Description Valid range Unit Default
In Data to convert
Input
Data to convert Depends on data type.
---
*
Order Conversion
order
Conversion order _LOW_HIGH or
_HIGH_LOW
_LOW
_HIGH
AryOut[]
(array)
Conversion
results array
In-out Conversion results array Depends on data type.
--- ---
Out Number of ele-
ments in result
Output Number of elements in
result
Depends on data type. --- ---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In
OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
An enumeration, array, array element, structure, or structure member can also be specified.
Order Refer to Function for the enumerators for the enumerated type _eBYTE_ORDER.
AryOut[]
(array)
OK
Out OK
Function
Enumerator Meaning
_LOW_HIGH Lower byte first, higher byte last
_HIGH_LOW Higher byte first, lower byte last
(@)ToAryByte
EN ENO
In Out
Order
AryOut