PersistentVars and Webvisu Element

ameba
2025-04-03
2025-04-07
  • ameba - 2025-04-03

    hello everyone

    I would like to try to better understand how persistent variables work.

    I created some boolean variables in the PersistentVars section initialized to the value TRUE.

    I have tied these boolean variables to toggle switches placed inside the HMI interface pages.

    Once the PLC program is started, the lever selectors, if operated, change their state, at least at a graphical level, but the persistent variables do not undergo any variation.

    Initially the above variables were declared as simple global variables, in this case the operation with the levers was correct; I then tried to transform them into persistent ones with the aim of using them as "settings saver"

    Thank you for support
    Bye

     
  • jampid

    jampid - 2025-04-07

    Bonjour,
    est-ce que les espaces de noms des variables sont bien indiqu dans les commutateurs ?
    Je viens de faire un petit essai: OK
    {attribute 'qualified_only'}
    VAR_GLOBAL PERSISTENT RETAIN
    xBit1: BOOL:=1;
    xbit2: BOOL:=1;

    END_VAR

    Déclaration de variable dans le commutateur (et aussi dans un voyant pour le test) :PersistentVars.xBit1
    Bon développement!

     

Log in to post a comment.