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

Persistent variables are not read after initialization

mike2160
2023-05-11
2023-05-12
  • mike2160 - 2023-05-11

    Hello everybody,

    I am currently working on a project on a Raspberry Pi and I need to use Persistent variables for the first time.
    My question: When i declare my variable (lamp = output (see picture)) as persistent and I do a Cold Reset it stays true. But when I start my program again it becomes false. Does this have to do with some settings I haven't configured or can this be somthing else?

    I am quite new to Codesys so any help is appreciated!

    Mike

     
  • eschwellinger

    eschwellinger - 2023-05-11

    which device?
    are they written on graceful shutdown?

     
  • mike2160 - 2023-05-11

    I am using a Raspberry Pi 4.
    What do you mean by a graceful shutdown?

    Mike

     
  • eschwellinger

    eschwellinger - 2023-05-11

    Retain/Persistent variables work that way:
    On exit/shutdown for the runtime - these retain variables will be saved to a retain file.
    On startup of the runtime they will be restored from that file.
    If you have no UPS connected how should this work on just switching off the Raspberry Pi?
    - there are only two options
    1. use a UPS (which makes the whole Pi more robust against SD card corruption
    2. an other option might be to use persistence manager from application composer
    (https://content.helpme-codesys.com/en/CODESYS%20Application%20Composer/ac_pm_overview.html)
    even here it would help to have UPS connected.

     
  • mike2160 - 2023-05-12

    Thank you, It worked using the persistence manager.

     

Log in to post a comment.