Function, Sample program, 2 instructions – Omron SYSMAC CP CP1E-N@@D@-@ User Manual
Page 166: Controlling data
2 Instructions
2-130
CP1E CPU Unit Instructions Reference Manual(W483)
Function
Note
• The above shift operations are applicable when the reset bit (bit 15 of C) is set to OFF.
• When reset (bit 15 of C) turns ON all bits in the shift register, from St to E will be reset (i.e., set to 0).
Sample program
• Shifting Data
If shift input W0.14 goes ON when CIO 0.00 is ON, and the reset bit W0.15 is OFF, words CIO 100
through CIO 102 will shift one bit in the direction designated by W0.12 (e.g., 1: Right) and the contents
of input bit W0.13 will be shifted into the rightmost bit, CIO 100.00. The contents of CIO 102.15 will be
shifted to the Carry Flag (CY).
• Resetting Data
If W0.14 is ON when CIO 0.00 is ON, and the reset bit, W0.15, is ON, words CIO 100 through CIO 102
and the Carry Flag will be reset to OFF.
Controlling Data
When the execution condition of
the shift input bit (bit 14 of C)
changes to ON, all the data from
St to E is moved in the designated
shift direction (designated by bit
12 of C) by 1 bit, and the ON/OFF
status of the data input is placed
in the rightmost or leftmost bit.
The bit data shifted out of the shift
register is placed in the Carry
Flag (CY)
All bits from St to E and the Carry Flag are set to 0 and
no other data can be received when the reset input bit
(bit 15 of C) is ON.
When the shift input bit (bit 14 of C) is ON, the contents
of the input bit (bit 13 of C) is shifted to bit 00 of the start-
ing word, and each bit thereafter is shifted one bit to the
left. The status of bit 15 of the end word is shifted to the
Carry Flag.
When the shift input bit (bit 14 of C) is ON, the contents
of the input bit (bit 13 of C) (I/O) is shifted to bit 15 on the
end word, and each bit thereafter is shifted one bit to the
right. The status of bit 00 of the starting word is shifted to
the Carry Flag.
0
15
CY
0
15
0
15
E
St
C
0
15
CY
0
15
0
15
E
St
Shift direction
Data input
Data input
15141312
SFTR
W0
100
102
0.00
C
St
E
C
㧦W0
0
15 14 13 12
1
1
0
15
0
CY
102
101
100
Data input:
W0.13
Reset input bit: 0
Shift input bit: 1
Shift direction
0
15
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
CY
0
0
15
CY
1/0
Data
input
1/0
0
15
CY
Data
input
Resetting Data
Shifting Data Left (from Rightmost to Leftmost Bit)
Shifting Data Right (from Leftmost to Rightmost Bit)