Given the following parameters:
- CLB clock = 10 nanoseconds
- Position sampling period = 100
microseconds or 10,000 CLB clocks
- Absolute encoder resolution =
ABS_MAX_POSITION = Q20 = 1048576
- Incremental encoder resolution = 1024
lines. Therefore QCLK_PER_REV = 2 x 1024 = 2048
The ABS_TO_INCR ratio is:
Equation 3.
Table 4-2 shows example translations from a change in absolute position to QCLKs generated.
Notice at sample 2 and sample 3, the
fractional edge accumulation is greater than 1. When this occurs, an additional QCLK is
generated and one is subtracted from the fractional edge accumulation.
Note: The absolute position
samples shown are for illustration only. Actual position change values may be much
larger than shown or may be in the reverse direction.
Table 4-2 Abs2Qep Example
Calculations
Sample |
Position |
Delta Position (1)
|
QCLKs |
Fractional Edges |
QCLKs Generated |
CLB Clocks per QCLK (2)
|
0 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
24000 |
24000 |
46.875 |
.875 |
46 |
217 |
2 |
53000 |
29000 |
56.6406 |
.875 + .6406 = 1.515 → .515 (3) |
56+1 (3) |
175 |
3 |
62000 |
9000 |
17.5781 |
.515 +.5781 = 1.09375 → .09375 (3)
|
17+1 (3) |
555 |
(1) Position(n) - Position(n-1). In this
example all changes are in the forward direction and zero is not crossed. If this
value were negative, the direction would be reverse.
(2) Number of CLB clocks betweeen each
QCLK pulse. This is based on the sampling frequency expressed in CLB clocks. For
this example: 10,000 CLB clocks / QCLKs generated
(3) An additional QCLK is generated and
the fractional portion is adjusted by 1.