Some questions about encoder management – Support Elsist https://support.elsist.biz/forums/topic/some-questions-about-encoder-management/feed/ Fri, 30 Oct 2026 08:13:33 +0000 https://bbpress.org/?v=2.6.20 it-IT https://support.elsist.biz/forums/topic/some-questions-about-encoder-management/#post-85213 Some questions about encoder management https://support.elsist.biz/forums/topic/some-questions-about-encoder-management/#post-85213 Thu, 09 Apr 2026 08:19:22 +0000 rock I have two questions, I have a CPU MPS054A110 on the machine and an expansion card PCB124B000 on which an encoder is connected to inputs 14 and 15, I read it with FB SysGetEncoder.

I am interested in how to set EQuote to zero or reset it?

The second question is can I connect a second encoder to DI on the CPU or do I have to add another expansion module PCB124*000?

]]>
https://support.elsist.biz/forums/topic/some-questions-about-encoder-management/#post-85217 Rispondi a: Some questions about encoder management https://support.elsist.biz/forums/topic/some-questions-about-encoder-management/#post-85217 Thu, 09 Apr 2026 12:55:53 +0000 Sergio Bertana The EQuote output of the SysGetEncoder function block cannot be reset or modified via a command. It can only be set to 0 by activating ZeroEn, which resets the encoder count upon detection of the encoder’s zero signal.

To manipulate the encoder count as required, the only approach is to handle it mathematically, as shown in the ST_EQuoteManage program example. Essentially, the program calculates the number of encoder pulses during each execution cycle and accumulates them into a count value. Since this count is a program variable, it can be adjusted as needed. Here is the core example.

    Pulses:=TO_INT(EInp.EQuote-EMemo); //Encoder pulses
    EMemo:=EInp.EQuote; //Encoder memo
    Quote:=Quote+TO_DINT(Pulses); //Encoder quote

Pay attention that the Pulses variable must be signed, because the difference in the quote can be negative when the encoder rotates counterclockwise (CCW).

To use the two digital inputs on the MPS054 to acquire the encoder, a protection code must be applied. The SysGetEncoder function block must be configured as follows:

    EInp.Address:=255; //Module address
    EInp.Channel:=0; //Module channel
]]>