Basic Function Instruction
6 -20
FUN 6
D
P
BSHF
BIT SHIFT
(Shifts the data of the 16-bit or 32-bit register to left or to right by one bit)
FUN 6
D
P
BSHF
Symbol
WY
WM
WS
TMR CTR
HR
OR
SR
ROR
DR
Range
Ope-
rand
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
D
○
○
○
○
○
○
○
○
*
○
*
○
Description
●
When the status of clear control "CLR" is at 1, then the data of register D and FO0 will all be cleared to 0.
Other input signals are all in effect.
●
When the status of clear control is "CLR" at 0, then the shift operation is permissible. When the shift control
"EN" = 1 or "EN
↑
" (
P
instruction) from 0 to 1, the data of the register will be shifted to right (L/R=0) or to
left (L/R=1) by one bit. The shifted-out bit (MSB when shift to left and LSB when shift to right) for both
cases will be sent to FO0. The vacated bit space (LSB when shift to left and MSB when shift to right) due to
shift operation will be filled in by the input status of fill-in bit "INB".
Example
Shifts the 16-bit register data
Ladder diagram
Key Operations
Mnemonic Codes
CLR
OTB
X4
X2
X1
X3
EN
INB
L/R
D :
R
3
Y0
6P.BSHF
OUT
FUN
LD
LD
LD
ORG
ORG X
1
LD X
2
LD X
3
LD X
4
FUN 6P
D
:
R
3
FO 0
OUT Y
0
B15
B0
←
←
← ← ← ← ← ← ← ← ← ← ← ← ← ← ← ←
X3=1
(Left shift)
Y0
Shifts the 16-bit data to left by one bit
X2
B15
B0
→
→
→ → → → → → → → → → → → → → → →
X3=0
(Right shift)
X2
Shifts the 16-bit data to right by one bit
Y0
Operand
D: The register number for shifting