Operator ShaftEncoderCompensate

The operator compensates runbacks of a ShaftEncoder.

The operator has an input link I which can be fed with encoder pulses On input link Dir, the current encoder direction can be defined.

Input pulses with backward direction are suppressed at the output. However, the operator will count the input pulses with backward direction internally. When the ShaftEncoderCompensate is fed with forward pulses again, they will be still suppressed until all backward pulses are compensated. In other words, each backward input pulse increments the internal counter. Each forward input pulse decreases this counter if it is > 0. A pulse is only output for each forward input pulse if the internal counter is equal to zero.

The parameter MaxPulseBits specifies the bit width of the internal counter, i.e. ShaftEncoderCompensate can compensate 2 ^ MaxPulseBits reverse pulses at maximum. If more than 2 ^ MaxPulseBits backward pulses occur, only 2 ^ MaxPulseBits pulses during runbacks can be compensated.

The current counter value i.e. the number of pulses to be compensated can be read using parameter CompensationCounter. It is possible to overwrite the current counter value by writing a new value to this parameter.

The operator can directly be connected to operator ShaftEncoder.

In the following waveform the functionality of the operator is illustrated.

An additional reset input can be used to reset the counter as shown in the following.

This operator is excluded from the VisualApplets functional simulation.

I/O Properties

Property Value
Operator Type O
Input Links I, signal data input
Dir, signal data input
Reset, signal data input
Output Link O, signal data output

Supported Link Format

Link Parameter Input Link I Input Link Dir Input Link Reset Output Link O
Bit Width 1 1 1 as I
Arithmetic unsigned unsigned unsigned as I
Parallelism 1 1 1 as I
Kernel Columns 1 1 1 as I
Kernel Rows 1 1 1 as I
Img Protocol VALT_SIGNAL VALT_SIGNAL VALT_SIGNAL as I
Color Format VAF_GRAY VAF_GRAY VAF_GRAY as I
Color Flavor FL_NONE FL_NONE FL_NONE as I
Max. Img Width any any any as I
Max. Img Height any any any as I

Parameters

MaxPulseBits
Type static parameter
Default 10
Range [2, 32]

This parameter specifies the bit width of the internal counter.

CompensationCounter
Type dynamic read/write parameter
Default 0
Range [0, 2^MaxPulseBits-1]

This parameter shows the current value of the compensation counter. Reading from the parameter shows the current value. Writing to the parameter overwrites the counter value.

Examples of Use

The use of operator ShaftEncoderCompensate is shown in the following examples: