3. Instruction Set

API

154

Mnemonic

 

Operands

Function

 

 

 

 

 

 

D

RAND

 

P

 

Random number

 

 

 

 

 

 

Controllers

ES2/EX2 SS2 SA2 SX2

SE

Type

 

Bit Devices

 

 

 

 

 

Word devices

 

 

 

 

 

 

 

Program Steps

 

OP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X

Y

M

S

K

H

KnX

KnY

KnM

KnS

T

C

D

 

E

 

F

RAND, RANDP: 7 steps

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S1

 

 

 

 

 

*

*

*

*

 

*

 

*

 

*

 

*

*

*

 

*

DRAND, DRANDP: 13

 

S2

 

 

 

 

 

*

*

*

*

 

*

 

*

 

*

 

*

*

*

*

 

 

 

 

 

 

 

 

 

steps

 

 

 

 

 

 

D

 

 

 

 

 

 

 

 

 

*

 

*

 

*

 

*

 

*

*

*

 

*

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

16-bit

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PULSE

 

 

 

 

 

 

 

 

 

 

32-bit

 

 

 

 

 

 

 

 

 

 

ES2/EX2

SS2

SA2

SX2

ES2/EX2

SS2

SA2

SX2

ES2/EX2

SS2

SA2

SX2

 

 

 

 

 

 

 

 

 

 

 

SE

SE

SE

 

 

Operands:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S1: Lower bound of the random number

 

S2: Upper bound of the random number

D: Operation

result

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Explanations:

1.The range of 16-bit operands S1, S2: K0S1 , S2K32,767; the range of 32-bit operands S1,

S2: K0S1 , S2K2,147,483,647.

2.Entering S1 > S2 will result in operation error. The instruction will not be executed at this time, M1067, M1068 = ON and D1067 records the error code 0E1A (HEX)

Program Example:

When X10 = ON, RAND will produce the random number between the lower bound D0 and upper bound D10 and store the result in D20.

X0

RAND D0 D10 D20

3 - 3 5 9

Page 475
Image 475
Delta DVP-ES2/EX2/SS2/SA2/SX2/SE manual Rand, DRAND, Drandp