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

PI Input value

  • geoweil - 2023-07-25

    Hi all

    I am writing a program and is stuck. I am using an incremental encoder to determine angular position. I want the PI_Counter value to be saved when the control unit loses power, and at startup the PI_Counter value should be the previously saved value. I am using an Epec 3606 control unit. Pulse counter is 2-channel directional mode.

    An example of what I am looking for in the program:
    1. Control unit switches on. PI_Counter value is 0.
    2. System operates, counter value adds to 400, system loses power.
    3. System starts back up, counter value is 400.

    If anyone can help with the program, I would greatly appreciate it.

    Thank you

    • CoderHelmut - 2024-01-12

      Hi geoweil,

      have you tried to save changed values to remanent area or using a VAR RETAIN?

      After restart you have to initialize Counter with last remanent value.

      Depending on changes per cycle and the possibilitiy of your control unit to write remanent storage.

      Otherwise you need a buffering system to ensure save backup of last PI_Counter value.

      May you could read this Thread to get further help:


Log in to post a comment.