Fast encoder

Let’s process values from ABZ encoder. In general, it does not differ that much from fast counter.

If you have Hardella IDE opened, you can either open code sample in the IDE, or you can create a new project with this code (File > New > Project > Fast encoder).

Encoder processing program

The most interesting parts are:

  1. PRU passes three values from the encoder block to the main PLC program: position, counter, zeroDetected

  2. The encoder block is not something magical. You can hold ctrl and click its name PRU_ABZ_ENCODER to navigate to the source:

    Source code of encoder processing block

    You can use the same ctrl+click approach to see the sources of other blocks of the standard library.

Updated:

Leave a Comment