API
Mnemonic
154
D
RAND
P
Type
Bit Devices
OP
X
Y
M
S
1
S
2
D
Operands:
S
: Lower bound of the random number
1
result
Explanations:
≦K2,147,483,647.
1. The range of 16-bit operands S
, S
K0≦S
1
2
2. Entering S
> S
will result in operation error. The instruction will not be executed at this time,
1
2
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
Operands
Word devices
S K H KnX KnY KnM KnS T C D E F RAND, RANDP: 7 steps
*
*
*
*
*
*
*
*
*
*
*
*
ES2/EX2/EC5
S
: Upper bound of the random number
2
, S
: K0≦S
, S
1
2
1
D0
D10
D20
Function
Random number
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
PULSE, 16-bit, 32-bit
SS2
SA2/SE/SE2
≦K32,767; the range of 32-bit operands S
2
3 . I n s t r u c t i o n S e t
Controllers
ES2/
SA2/
EX2/
SS2
SE/
SX2
EC5
SE2
Program Steps
DRAND, DRANDP: 13
steps
SX2
D: Operation
, S
1
3 - 4 7 9
:
2
Need help?
Do you have a question about the DVP-EX2 and is the answer not in the manual?