Results 1 to 8 of 8

Thread: PERSISTENT RETAIN variable

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2016
    Posts
    22

    Default PERSISTENT RETAIN variable

    hi
    I work with the cr0032 controller and I wont that after the variable is change and I download new program or turn off/on the controller the variable will be retain
    so I declared PERSISTENT RETAIN variable .
    unfortunately when the variable is changed and I download update program the variable are reinitialized (I perform login because the download option is unavailable)
    do you understand what is the problem?
    thank you in advance

  2. #2
    Join Date
    May 2009
    Location
    Minneapolis, MN
    Posts
    295

    Default

    You need to use the MEM_RETAIN_PARAM function block.
    Declare variables as RETAIN and use the memory locations.

    Example
    VAR_RETAIN
    wWordValue AT %MB0 : WORD;
    END_VAR

  3. #3
    Join Date
    Oct 2016
    Posts
    22

    Default

    hi
    where can find the lib of MEM_RETAIN_PARAM function block

    thank you for your help

  4. #4
    Join Date
    May 2009
    Location
    Minneapolis, MN
    Posts
    295

    Default

    Its in the library for the CR0032.

  5. #5
    Join Date
    Oct 2016
    Posts
    22

    Default

    hi

    in my application the user can change the controller cr0032 data from outside
    does the FB MEM_RETAIN_PARAM wrote the data to memory every program cycle or only when there is a change in the data .

    thank you for your help

  6. #6
    Join Date
    May 2009
    Location
    Minneapolis, MN
    Posts
    295

    Default

    The FB MEM_RETAIN_PARAM allows for data to not be affected by a download. If the user changes the variable it works just like a normal retain.

  7. #7
    Join Date
    Oct 2016
    Posts
    22

    Default

    Quote Originally Posted by yair-c View Post
    hi

    in my application the user can change the controller cr0032 data from outside
    does the FB MEM_RETAIN_PARAM wrote the data to memory every program cycle or only when there is a change in the data .

    thank you for your help
    hi Erik
    I want to sharpen the question about MEM_RETAIN_PARAM
    Memory components have a limited amount of times you can write to them.
    Therefore, if you write into memory in all software cycle, memory will be destroyed in a matter of hours.
    I wont to be shore that the function block MEM_RETAIN_PARAM write to memory only when there is a change in the data and not every program cycle

    thank you in advance

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •