2 Instruction Descriptions
2-864
NJ-series Instructions Reference Manual (W502)
ReadNbit_**
The ReadNbit_** instructions read zero or more bits from a bit string.
A ReadNbit_** instruction reads the values of the upper Size bits from read position Pos in source bit
string In. It assigns the values to read result Out.
The name of the instruction is determined by the data types of In and Out. For example, if In and Out
are the WORD data type, the instruction is ReadNbit_WORD.
Instruction Name FB/FUN Graphic expression ST expression
ReadNbit_** N-bit Read Group FUN Out:=ReadNbit_**(In, Pos,
Size);
“**” must be a bit string data
type.
Variables
Name Meaning I/O Description Valid range Unit Default
In Read
source
Input
Bit string to read Depends on data type.
---
0
Pos Read posi-
tion
Bit position to read 0 to No. of bits in In −1
Size Read size Number of bits to read 0 to No. of bits in In 1
Out Read result Output Read 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
Pos OK
Size OK
Out Must be same data type as In
Function
(@)ReadNbit_**
EN ENO
In Out
Pos
Size
"**" must be a bit string data type.