Rockwell Automation Publication 2198-UM004A-EN-P - October 2019 325
Motion Control Applications Chapter 12
Using PR Command Programming with the Compare Function
To use motion commands with the Compare function, we recommend using PR
command programming.
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 148
. Set the numerator ID153 (P1.046) EncoderOutputResolution
and denominator ID176 (P1.097) EncoderOutputDenominator of the encoder's
pulse output, whose default is based on the comparing axis runs 10000 pulses per
rotation of motor.
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 cycle 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.