FB und Retain Variablen

guerillero
2013-01-14
2013-01-14
  • guerillero - 2013-01-14

    Hallo,

    Ich meine mich dunkel daran erinnern zu können, dass bei V2.3 alle Variablen Retain gespeichtert wurden sobald eine Variable als Retain deklariert wurde. Ist meine Erinnerung da richtig und ist das bei V3 auch so. Die Hilfe habe ich bereits bemüht.

    Gruß

    Michael

     
  • singleton - 2013-01-14

    Bei mir steht dazu folgendes in der Hilfe:

    Zitat:
    If a local variable in a program is declared as VAR RETAIN, then exactly that variable will be saved in the retain area (like a global retain variable)
    If a local variable in a function block is declared as VAR RETAIN, then the complete instance of the function block will be saved in the retain area (all data of the POU), whereby only the declared retain variable will be handled as a retain.
    If a local variable in a function is declared as VAR RETAIN, then this will be without any effect. The variable will not be saved in the retain area ! If a local variable is declared as PERSISTENT in a function, then this will be without any effect also !!

     
  • guerillero - 2013-01-14

    Danke,

    Wenn man weiß wo man suchen muss, dann findet man es auch.

    Jetzt noch eine Bonusfrage.

    Ich habe FB_A, FB_B und FB_C.

    FB_B EXTENDS FB_A

    und

    FB_C EXTENDS FB_B

    Jetzt habe ich in FB_B Retain Variablen. Welche Bausteine werden jetzt in den Retain Speicher gelegt?

    Nur FB_B oder auch FB_C.

    Gruß Michael

     

Log in to post a comment.