AH500 Programming Manual 
6-256 
API 
Instruction code  Operand  Function 
1112    BSFR  P 
D, n 
Shifting the states of the n bit 
devices by one bit to the right 
Device
X  Y  M  S  T  C  HC  D  L  SM  SR  E  PR  K  16#
“$”  DF 
Pulse instruction
16-bit instruction (5 steps)
32-bit instruction 
Symbol: 
 
D
:
Initial device involve in the shift  Bit 
n
:
Data length  Word 
Explanation: 
1.  The states of the n bit devices starting from D are shifted by one bit to the right. The state of 
D+n-1 is cleared to 0, and the state of D is transmitted to the carry flag SM602. 
2.  Generally, the pulse instruction BSFRP is used. 
3.  The operand n should be within the range between 1 and 1024. 
Example: 
When X0.0 is ON, the states of M0~M5 are shifted by one bit to the right, the state of M5 is cleared 
to 0, and the state of M0 is transmitted to the carry flag SM602. 
 
After the shift
Carry flag
C
arry flag
1
M0M1M2M3M4M5
M0M1M2M3M4M5
101000
010000
Being cleared to 0
 
Additional remark: 
1.  If D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error 
code in SR0 is 16#2003. 
2.  If n is less than 1, or if n is larger than 1024, the instruction is not executed, SM0 is ON, and 
the error code in SR0 is 16#200B.