5
Categories and Use of Basic Application Instructions
DVP-PM Application Manual
5-133
API Mnemonic
Operands
Function
154
D RAND P
Random number
Controllers
20PM
10PM
Bit Devices
Word devices
Program Steps
Type
OP
X Y M S K H
KnX
KnY KnM KnS T C D V Z
S
1
*
*
*
*
*
*
*
*
*
*
*
S
2
*
*
*
*
*
*
*
*
*
*
*
D
*
*
*
*
*
*
*
*
RAND, RANDP: 7 steps
DRAND, DRANDP: 13 steps
Operands:
S
1
: Lower bound of the random number
S
2
: Upper bound of the random number
D
: Operation result
Explanations:
1.
The range of 16-bit operands
S
1
,
S
2
: K0
≦
S
1
,
S
2
≦
K32,767; the range of 32-bit operands
S
1
,
S
2
: K0
≦
S
1
,
S
2
≦
K2,147,483,647.
2. 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)
3.
When RAND is used as 16-bit instruction, Z device cannot be adopted; when RAND is used as 32-bit
instruction, V device cannot be adopted.
4.
When specifying the bit device of KnX(Y/M/S), the starting No. should be a multiple of 16 in octal or decimal
format. For example, K1X0, K4Y20 (octal); K1M0, K4S16 (decimal)
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
Содержание DVP-10PM
Страница 1: ......
Страница 45: ...2 Hardware Specifications and Wiring DVP PM Application Manual 2 30 MEMO...
Страница 125: ...3 Functions of Devices in DVP PM DVP PM Application Manual 3 80 MEMO...
Страница 341: ...8 Application Examples DVP PM Application Manual 8 2 Trajectory 3 Trajectory 4...
Страница 427: ...9 Electrical CAM DVP PM Application Manual 9 74...
Страница 437: ...10 Encrypting User Program DVP PM Application Manual 10 10 MEMO...
Страница 458: ...11 G code Application DVP PM Application Manual 11 21 B O100 main program...
Страница 561: ...14 Appendix DVP PM Application Manual 14 4 MEMO...