Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Absolute encoder position

oliver82
2016-10-20
2016-11-01
  • oliver82 - 2016-10-20

    Hello to everybody,
    I've a problem regarding the absolute position of a brushless absolute motor encoder.
    Encoder is a multiturn absolute with a resolution of 4096 x 4096 inc.
    In my application I've an axis that every cycle increments its position. The problem appears when the axis is powered on. The position is different from the previuous one and an homing is needed. Axis is provided of a motor reductor so every cycle of the machine the encoder perform (4096x70 increm.). In such condition after 58 cycle (or less) of the machine the position goes in overflow.
    I try to use FB "SMC3_PersistPositionSingleTurn" (also if my encoder is multiturn) inserting 24 as number of absolute bit. But still the position is not well recovered.
    At the moment every power on I have to permorm an axis homing.
    I'm using Codesys 3.5 SP8.
    Someone has some suggestions?
    Thanks

     
  • plcmax - 2016-10-31

    Hi,
    This should work if the values are really retained.
    Which plc are you using are you sure the retains are ok for this on this plc?
    Best regards
    Plcmax

     
  • Kim - 2016-11-01

    For sure Codesys supports this.
    I will assume your encoder is truly in absolute mode (some absolute encoders default to singleturn mode even if they are capable of multiturn, normally changed by a parameter within the encoder or drive controller). You can check the position value reported directly from the encoder (not the motor object) after boot if you're not sure.

    You need to make use of SMC3_PersistPosition.
    First off declare a variable of the type SMC3_PersistPosition_Data in a persistent area (on a PC and some other platforms, just tag it PERSISTENT RETAIN, on other platforms you need to add a Persistent Variable List (PVL) and add it within that instead).
    Then in any program that executes every cycle, add a SMC3_PersistPosition function block call with your axis and persistent variable as input. This will allow Codesys to keep track of the position so it can calculate the correct position at boot even after rollovers.

     

Log in to post a comment.