EasyManuals Logo

Omron NJ501-1500 User Manual

Omron NJ501-1500
990 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #422 background imageLoading...
Page #422 background image
2 Instruction Descriptions
2-374
NJ-series Instructions Reference Manual (W502)
Encoder
The Encoder instruction finds the position of the highest TRUE bit in array elements that consist of a
maximum of 256 bits.
* If you omit the input parameter, the default value is not applied. A building error will occur.
The Encoder instruction finds the position of a TRUE bit in a specified range of bits in array to convert
In[]. The instruction looks for a TRUE bit in 2
Size
bits from In[0]. The position of the TRUE bit in this
range is expressed in binary and stored in the Size bits in the lower bits of conversion result Out. FALSE
is stored in the remaining bits of Out.
If there is more than one TRUE bit in the specified range, the position of the highest bit that is TRUE is
found. Always attach the element number to input parameter that is passed to In[], e.g., array[3].
Consider an example for when Size is USINT#4 and In[] is a BYTE array. Size is USINT#4, so the range
in which to find a TRUE bit is 2
4
, or 16 bits, from In[0]. In the following diagram, the ninth bit in the range
is TRUE.
Instruction Name FB/FUN Graphic expression ST expression
Encoder Bit Encoder FUN Out:=Encoder(In, Size);
Variables
Name Meaning I/O Description Valid range Unit Default
In[] (array) Array to
convert
Input
Array to convert Depends on data type. --- *
Size Bits to
convert
Number of bits to convert 0 to 8 Bits 1
Out Conver-
sion result
Output Conversion 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[] (array) OKOKOKOKOK
Size OK
Out OK
Function
(@)Encoder
EN ENO
In Out
Size

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Omron NJ501-1500 and is the answer not in the manual?

Omron NJ501-1500 Specifications

General IconGeneral
BrandOmron
ModelNJ501-1500
CategoryController
LanguageEnglish

Related product manuals