382 Rockwell Automation Publication 2198-UM004D-EN-P - December 2022
Chapter 12 Motion Control Applications
Using PR Command Programming with the Compare Function
To use the Compare function, you must be in PR operation mode and use PR
commands.
With PR command programming, write commands configure the high-speed
position compare function, as well as execute the motion commands once
configuration is complete. See Chapter 11
for details on PR command
programming.
The following example describes how the PR command works and is
illustrated in Figure 190
. Set the numerator ID153 (P1.046)
EncoderOutputResolution and EncoderOutputDenominator ID179 (P1.097),
whose default is based on the comparing an axis using 10000 pulses per motor
rotation.
1. PR#1 use write commands to edit data array #50.
2. PR#2 use write commands to edit data array #51.
3. PR#3 use write commands to edit data array #52.
4. PR#4 confirms that the Compare function is disabled
(ID331.X (P5.039.X) Bit 0 = 0).
5. PR#5 sets the start position to 50.
6. PR#6 sets the compare amount to 3, with a delay of 1 ms to allow the PR
command with the use of Compare function to be executed.
7. PR#7 enables the Compare function in cyclic mode, which clears the
compare axis to 0 after compare is complete and executes PR#45. It
selects encoder of the motor as the capturing axis, setting 'normally
closed' as the trigger logic with pulse output duration of 100 ms.
8. PR#8 sets the speed command to 50 rpm.
9. PR#45 sets the incremental command to 50000 PUU and then carries on
to PR#46, keeping the speed command setting of 50 rpm.
Figure 189 - PR Command with Application of Compare Function
PR#6 (I)
Write
DLY=[10] 1 ms
P5.058=3
PR#5 (I)
Write
DLY=[0] 0 ms
P5.056=50
PR#45 (I)
Position
DLY=[0] 0 ms
50000 PUU
INC
100rpm
PR#8 (I)
Speed
DLY=[0] 0 ms
50 rpm
Acc=[0] 3.33 ms
Dec=[0] 3.33 ms
PR#46
Speed
DLY=[0] 0 ms
50 rpm
Acc=[0] 3.33 ms
Dec=[0] 3.33 ms
PR#3 (I)
Write
DLY=[0] 0 ms
Arr[52]=40000
PR#4 (I)
Write
DLY=[0] 0 ms
P5.059=
0x00640030
PR#2 (I)
Write
DLY=[0] 0 ms
Arr[51]=30000
PR#7 (I)
Write
DLY=[0] 0 ms
P5.059=
0x0064103B
PR#1
Write
DLY=[0] 0 ms
Arr[50]=20000