Vai al contenuto

Some questions about encoder management

Home Forum Controllori SlimLine e Netsyst (LogicLab) Some questions about encoder management

Stai visualizzando 2 post - dal 1 a 2 (di 2 totali)
  • Autore
    Post
  • #85213
    rock
    Partecipante

    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?

    #85217
    Sergio Bertana
    Amministratore del forum

    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
Stai visualizzando 2 post - dal 1 a 2 (di 2 totali)
  • Devi essere connesso per rispondere a questo topic.