Delta Electronics Programmable Logic Controller DVP-PLC User Manual
Page 485

9 Application Instructions API 150-199
DVP-PLC Application Manual
9-13
API Mnemonic
Operands
Function
154
RAND P
Random Number
Controllers
ES/EX/SS SA/SX/SC EH/SV
Bit Devices
Word Devices
Program Steps
Type
OP
X Y M S K H
KnX KnY KnM KnS T
C
D
E
F
S
1
*
*
*
*
*
*
*
*
*
*
*
S
2
*
*
*
*
*
*
*
*
*
*
*
D
*
*
*
*
*
*
*
*
RAND, RANDP: 7 steps
PULSE 16-bit 32-bit
ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands:
S
1
: Lower bound of the random number S
2
: Upper bound of the random number D: The random number
produced
Explanations:
1.
S
1
≦S
2
; K0 ≦ S
1
, S
2
≦K32,767
2.
See the specifications of each model for their range of use.
3. Entering
S
1
> S
2
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.
X10
RAND
D0
D10
D20