BSR (d, n)

Chapter 5 Instruction Specifications

Item number

Application instructions-10

 

 

Name

 

BCD shift right

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ladder format

 

 

 

 

 

 

Condition code

 

 

 

 

Processing time (s)

Remark

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

R7F4

 

R7F3

 

R7F2

R7F1

 

R7F0

Average

Maximum

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BSR (d, n)

 

 

DER

 

ERR

 

SD

 

V

 

 

 

C

 

 

 

 

 

 

Upper case: W

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

32

 

 

Lower case: DW

 

 

 

 

 

z

 

 

z

 

 

z

 

z

 

 

 

z

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Instruction format

 

 

 

 

 

 

Number of steps

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Condition

 

 

 

Steps

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BSR (d, n)

 

 

 

 

 

 

 

 

 

 

 

 

 

3

 

 

40

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit

 

 

 

 

 

 

 

Word

 

Double word

 

Constant

 

 

 

Usable I/O

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Other

 

X

Y

M

 

 

CU, CT

 

WX

WY

WM

 

TC

DX

DY

DM

 

 

 

 

 

 

 

 

R,

 

 

TD, SS,

 

 

 

 

WR,

 

 

 

 

DR,

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

d

I/O to be shifted

 

 

 

 

 

 

 

 

 

 

{

 

{

 

{

 

{

{

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

n

Number of digits to be

 

 

 

 

 

 

 

 

 

{

{

 

{

 

{

 

 

 

 

{

 

The constant is set in

shifted

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

decimal.

Function

Shifts the contents of d to the right (toward the lower digits) by n digits (1 digit is equivalent to 4 bits).

“0” is set from the most significant bit to the nth digit.

The digits from least significant bit to the nth digit are discarded.

Before execution

 

 

 

 

 

 

 

 

 

 

 

 

 

n digits

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

After execution

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Discarded

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

0000

 

 

 

 

 

 

0000

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

n digits

 

 

 

 

 

 

 

 

Least significant bit (LSB)

 

 

 

 

 

 

 

 

 

 

 

 

Most significant bit (MSB)

 

 

If d is a word:

Designates the shift amount, depending on the contents (0 to 3) of the lower 2 bits (b1, b0) of n (WX,

 

 

 

 

WY, WR, WM, TC). (Upper bits are ignored and considered as “0.”)

 

 

 

 

The n (constant) can be set to 0 to 3 (decimal).

If d is a double word:

Designates the shift amount, depending on the contents (0 to 7) of the lower 3 bits (b2 to b0) of n

 

 

 

 

(WX, WY, WR, WM, TC). (Upper bits are ignored and considered as “0.”)

 

 

 

 

The n (constant) can be set to 0 to 7 (decimal).

Notes

If n is equal to “0,” the shifting is not performed.

Program example

 

X00001 DIF1

 

 

 

LD

X00001

 

BSR

(WR0000 ,1 )

 

AND

DIF1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BSR

(WR0000 ,1)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

]

 

Program description

When X00001 rises, the content of WR0000 is regarded as BCD code and shifted to the right by four bits.

At this time, the values in the lower 4 bits (b3 to b0) are deleted and “0000” is set in the upper four bits (b12 to b15).

 

 

Before the shift

 

 

 

 

 

After the shift

 

H

1

2

3

4

 

 

H

0

1

2

3

 

0001

0010

0011

0100

 

 

 

0000

0001

0010

0011

 

Deleted

 

 

 

 

 

Set to “0”

 

 

 

 

 

 

 

 

 

 

 

 

5-80

Page 130
Image 130
Hitachi NJI-350B manual Application instructions-10, BCD shift right, BSR d, n