Rockwell Automation Publication 842E-UM001C-EN-P - September 2016
75
Appendix
B
RSLogix 5000® Sample Code
This appendix gives examples of using your encoder, including how to use
RSLogix 5000 to set and read parameters.
•
Linear Scaling Example
, next section
•
Installing Your Project on page 76
•
Using an Explicit Message Configuration to Set Preset Encoder Value
on page 82
•
Using an Explicit Message Configuration to Read Preset Encoder Value
on page 86
•
Using an Explicit Message Configuration to Obtain the Encoder
Runtime in Seconds on page 91
Linear Scaling Example
A linear cart is to be controlled using ball screw slide. The cart will stop after
1 m
(3.28 ft) of travel for loading and unloading. For precise measurement of
the distance between stops, 10,000 steps are required.
The cart travels 20 mm (0.79 in.) for one revolution of the encoder, which
brings the number of rotations the encoder turns for 1 m (3.28 ft) of travel
distance to 50. For a resolution of 10,000 steps per meter, the encoder requires
200 steps per revolution.
There are three stops along the 3 m (9.84 ft) track, so our total resolution must
be at least 3 x 10,000 = 30,000 steps to cover the length of the track. For the
scaling function, our total resolution must be
2
n
x CPR
Or in this case
2
8
x 200 = 51,200