Defining the Valid 16-bit Position Range
For general scaling information, see the Scaling Overview topic.
Because the RMC uses 16-bit positions, positions must all fit within a range of 65,536 position units. Because position units are user definable, this range does not limit most applications. See the section below on defining position units.
For quadrature axes, the Coordinate Limit parameter is used with the Scale parameter to define the position range. If the Scale parameter is negative, then the position range extends from the Coordinate Limit value minus 65535 up to the Coordinate Limit value. If the Scale parameter is non-negative, then the position range extends from the Coordinate Limit value up to the Coordinate Limit value plus 65535. The following chart summarizes this concept:
Scale |
Min. Position |
Max. Position |
< 0 |
Coord. Limit - 65535 |
Coord. Limit |
³ 0 |
Coord. Limit |
Coord. Limit + 65535 |
Other than using the sign of the scale, the Coordinate Limit parameter is independent of the scale parameter. Therefore, it is recommended that you choose one of the following Coordinate Limit values to allow you to use standard signed or unsigned position units. Other position ranges are non-standard and take special treatment in PLCs:
Scale |
Coordinate Limit |
Range |
Standard |
< 0 |
65535 |
0 to 65535 |
Unsigned |
< 0 |
32767 |
-32768 to 32767 |
Signed |
³ 0 |
0 |
0 to 65535 |
Unsigned |
³ 0 |
-32768 |
-32768 to 32767 |
Signed |
Translating to Position Units
The translation of quadrature counts to position units is done incrementally. That is, the change in quadrature counts is converted to a change in position units. These quantities are then added to the current Counts and Actual Position status words. Therefore, only the Scale and the Prescale Divisor bits are used in the conversion from Counts to Actual Position.
The following formula summarizes the translation from change in quadrature counts to the change in position units:
The RMC ensures that no fractional position units are lost in this conversion.
Determining the correct Scale and Prescale Divisor is a three-step process. First, the exact Scale value is calculated assuming a Prescale Divisor of 1. Next, the optimum Prescale Divisor is selected. Finally, the exact Scale is multiplied by the Prescale Divisor and rounded to the nearest integer. The best way to do this is to use RMCWin’s Quadrature Calibration Utility. This utility does all of these calculations for you, plus helps you select the appropriate position unit range. If you do not choose to use this utility, follow the instructions in the steps below:
1. Calculating the Exact Scale Value
The precise scale value is calculated according to the following formula:
Therefore, the information required to calculate your exact scale is the number of position units you want for a given number of counts. The Sign factor determines the direction your position units move in relation to your counts; enter a 1 if increasing counts should increase the actual position, or enter a 1 if increasing counts should decrease the actual position. For example, if you have a 1000-line encoder and therefore 4000 quadrature counts per revolution, and you want to have 3600 position units per revolution, then you would do the following calculation because you want 3600 position units change when you have a 4000 quadrature count change:
One restriction you have at this point is that you cannot have more position units than counts over a given range. That is, DPosition Units must be less than or equal to DCounts. If this is not the case, you must either reduce the number of position units—usually dividing it by a factor of 10 accomplishes this—or choose an encoder that has more counts. For example, a user who wanted 36000 position units per 4000 quadrature counts would need to upgrade to a 9000-or-more-line encoder or drop to 3600 position units per revolution.
2. Selecting the Optimum Prescale Divisor
The Prescale Divisor can have values of 1, 2, 4, or 8. Because the Scale is divided by the Prescale Divisor, this feature allows a fractional scale. Pick the largest Prescale Divisor you can multiply the Scale by and still be between 32768 and 32768. For example, suppose your Scale comes to 6324.70. The following table shows the possible Scales and Prescale Divisors you could use and the effective scale:
Scale |
Divisor |
Effective Scale |
Error from 6324.70 |
6325 |
1 |
6325/1 = 6325 |
0.005% |
12649 |
2 |
12649/2 = 6324.5 |
0.003% |
25299 |
4 |
25299/4 = 6324.75 |
0.0008% |
50598 |
8 |
Invalid scale |
Invalid |
Therefore, in this example, a Scale of 25299 and a Prescale Divisor of 4 should be used. Notice that this reduced the error in the scale factor.
3. Entering the Correct Scale Value
Now that the Prescale Divisor has been calculated, you must multiply the exact Scale value you found in step one by this Prescale Divisor and round to the nearest integer. For example, if you had a scale that came to 2949.12, then you would have selected a Prescale Divisor of 8. Therefore your correct Scale parameter would be 2949.12 x 8 or 23592.96 rounded to 23593. Therefore, your effective scale is 23593 / 8 = 2949.125, which is within 0.0002% of the exact scale.
Note: If the Scale parameter value you calculate to enter is 32768, you must enter 0 instead. This is required because the range of signed 16-bit number is 32768 to 32767. Therefore, 32768 is not a valid number. We chose 0 to represent this value instead.
Example 1:
A user with a 1024-line encoder wishes to have position units in tenths of a degree of rotation on the encoder’s shaft. Therefore, the user has 4096 counts per revolution and wants to have 3600 position units over that distance. This gives us the following exact scale calculation:
Notice that the scale comes out to a whole number. This is an ideal situation, as there will be no scaling error. This will be the case when encoders are used that have line counts that are powers of two, such as 64, 256, 512, 1024, 2048, and 4096.
We choose a Prescale Divisor of 1 for the following two reasons:
We have no choice. Any larger divisor, when multiplied by the Scale value, would overflow the acceptable range for the Scale value.
Whenever the Scale calculated in the first step comes out to an exact number, the larger Prescale Divisors do not add any accuracy to the scale. For example, suppose this user wanted position units of degrees. Therefore, the scale would be 360 x 32768 divided by 4096, which comes exactly to 2880. Even if we used a divisor of 8, the scale value entered would be 2880 x 8, which is 23040. The effective scale is 23040/8, which comes out to 2880.
Therefore, we use the following two values:
Scale = 28800
Prescale Divisor = 1
Example 2:
A user has a 200-line encoder mounted on shaft A. Shaft A is geared 1:15 with shaft B, which does the work. Therefore, it is on shaft B that the user wishes to have position units measured in 1000ths of a revolution.
We know that the user has 1000 position units per revolution on shaft B. We need to find out how many encoder counts there will be for one revolution of shaft B. There are 800 quadrature counts per shaft A revolution. Because it will take fifteen turns on shaft A to turn shaft B once, there will be 800 x 15 or 12000 quadrature counts for each revolution of the shaft B.
Notice that we could increase the position units to be 10,000ths of a revolution and still have more counts than position units, but we will assume that the user really doesn’t want to use this extra resolution. Increasing the position unit resolution would lower the maximum speed, as speeds are limited to 65535 position units per second. Therefore, we can calculate our scale:
Next, we need to choose a Prescale Divisor. The largest of the valid divisors (1, 2, 4, and 8) that can be multiplied by 2730.667 and still be within ±32768 is 8. When we multiply this divisor by the scale and round it to the nearest integer, we get the following parameters:
Scale = 21845
Prescale Divisor = 8
In this case our effective scale is 2730.625 instead of 2730.667, which means our scale has an error of 0.0015%.
See also:
Copyright (c) 1997-2015 by Delta Computer Systems, Inc.